If we believe in the sovereignty of God, and we believe in the omniscience of God, it seems a fair question to ask: why bother praying? If God knows everything already, and nothing happens that is outside of his control, do our prayers affect anything? Aren’t even our prayers directed by God?
Here is John Calvin’s answer from Institutes of the Christian Religion:
But, someone will say, does God not know, even without being reminded, both in what respect we are troubled and what is expedient for us, so that it may seem in a sense superfluous that he should be stirred up by our prayers – as if he were drowsily blinking or even sleeping until he is aroused by our voice? But they who thus reason do not observe to what end the Lord instructed his people to pray, for he ordained it not so much for his own sake as for ours. Now he wills – as is right – that his due be rendered to him, in the recognition that everything men desire and account conducive to their own profit comes from him, and in the attestation of this by prayers. But the profit of this sacrifice also, by which he is worshiped, returns to us. Accordingly, the holy fathers, the more confidently they extolled God’s benefits among themselves and others, were the more keenly aroused to pray…
Still it is very important for us to call upon him: First, that our hearts may be fired with a zealous and burning desire ever to seek, love, and serve him, while we become accustomed in every need to flee to him as to a sacred anchor. Secondly, that there may enter our hearts no desire and no wish at all of which we should be ashamed to make him a witness, while we learn to set all our wishes before his eyes, and even to pour out our whole hearts. Thirdly, that we be prepared to to receive his benefits with true gratitude of heart and thanksgiving, benefits that our prayer reminds us come from his hand.
In short, everything that God does is for his glory and our benefit (RC Sproul emphatically points out that these two things happen ‘in that order’). Whilst God seeks his own glory above all else, we benefit when God is glorified. God is glorified when we pray to him and, as he is glorified in our prayer, we receive the benefits of prayer from Him.