Prayer is not forcing the hand of God to follow our every will and command. He is a loving Father that He knows which prayers will be good for us and which are not.
There are prayers that will be left unanswered and you will eventually know why. For example, there was a time in my life when I prayed to work abroad. I prayed hard for it. I am so glad that God did not answer it. I would have not met my wife and the people I cherish now if I decided on my own.
It does not mean that we stop praying for those that we truly believe that God can answer. Even if it takes a while, our perspective will change and even our prayer life will change. Prayer makes us know more of who God is.
Most of my struggles in the Christian life circle around the same two themes: why God doesn’t act the way we want God to, and why I don’t act the way God wants me to. Prayer is the precise point where those themes converge. –Prayer: Does It Make Any Difference (Philip Yancey)
Prayer does not change God. But it changes us.