Although God is the ultimate authority over all, He gave man the freedom to choose (Deuteronomy 30:19, Joshua 24:15). We must understand though that our choices have consequences for good or evil (Deuteronomy 30:10-20). Freedom comes with responsibility and accountability. We must also understand that freedom does not give us the right to be presumptuous before God. He has the right to choose. Ours is only delegated from Him. He sometimes chooses to chastise or judge people. Do we respect His power or question it? When we pray to God, He chooses the answer. He may say yes, no, or not right now. We can either believe He is doing the right thing with our best interest in mind from His eternal perspective and trust Him, or we can complain and rebel. Sometimes God says no just to see what our response will be. Will we submit to Him with a right attitude, showing faith; or will we act like a stubborn spoiled brat and throw a tantrum? Do we expect God to serve us, or do we understand that we are here to serve His will (Revelation 4:11)? Can God say no to us? That is a perfect test of whether or not we are submitted to His authority. If we cannot accept a no from God, then He is not our Lord.
Some people have a dangerous sense of entitlement. They expect God, society, and the government to serve their desires. They think they are owed something. God does not owe anyone anything. He created and owns the universe, including us. He does not answer to us. We answer to Him. When He blesses us, it is only because He loves us, not because we deserve it. What we deserve is hell. Anything above that is only because of the grace of God. When God says no to us, it is a reminder of these things.
The soothsayer Balaam did not learn this lesson (Numbers 22-24). King Balak sent for him to curse Israel, and God told him not to go. He forced the issue, and God told him to go but only say what He gave him to say. An angel went to kill him. This seems confusing, but it is like someone who keeps nagging until they are finally told yes. Eventually Balaam did lose his life because although God would not let him curse Israel, he got them to curse themselves through sin (Numbers 31: 8 & 16, Revelation 2:14). There is a place for persistence in prayer (Luke 11:5-13, Luke 18:1-8), but we should have the wisdom to know when it is time to leave it in God's hands. Paul had to learn this. He asked God three times to heal him, and finally God told him to receive His grace to handle it instead of get out of it (2Corinthians 12:7-10).
We should be careful what we ask for, because we just might get it. Israel complained about God's provisions in the wilderness, so He gave them quail to eat, but because they consumed it in their uncontrolled lust, many died (Exodus 16). Numbers 11:1-34 talks about this incident says they buried the people that lusted. Psalm 106:14-15 says God gave them their request, but sent leanness into their soul. Their fleshly lust was satisfied, but they were spiritually empty. Later, they wanted a king (1Samuel 8). God knew they would eventually ask for this (Deuteronomy 17:14-15). When they were warned what this request would bring upon them, they still insisted. The Jews persistently demanded Pilate have Jesus killed. When he said he did not want the guilt of His blood on him, they said they would take responsibility for it (Matthew 27:25). They got what they asked for. The Lord wanted His blood to remit their sins instead of calling for their judgment (Matthew 26:28). They even said they chose Caesar over Jesus (John 19:15). It was the Romans they chose who came later and destroyed their nation, their capital, and their temple. We must not use our liberty as a license to satisfy our evil desires (1Corinthians 8:9, Galatians 5:13,1Peter 2:16, 2Peter 2:19).
Sometimes a no from God for one thing is because God has another that is better. It is not that we are asking for something evil or completely contrary to the will of God. It could be God has an even better plan for us. It could also be at timing issue. God may not be saying not ever, just not right now. There are many reasons for this. One of them is that God sees that we are not ready to properly handle it yet. He wants us to have it, but we need to go through some preparation to be able to responsibly handle it. Another is that we need to value the precious things God wants to give us. If they come too easily, we will not properly value them and treat them accordingly. God does not withhold anything that is good for us (Psalm 34:11). He will keep every one of His promises to us (Joshua 21:45, 2Corinthians 1:20). We should trust that God knows who, what, when, where, why, and how that is. It is not always clear to us, but that is exactly what faith is for. One way to make sure your prayers are always answered is to ask for the will of God to be done (Matthew 6:10, Luke 22:42, 1John 5:14).