Here is part 2 of R. C. Sproul’s article on prayer. (I mentioned part 1 here)
In this one he asks two questions. Does prayer change God’s mind? Does prayer change things? The answer he gives is different for each one. Go read the whole thing with bonus quotes from Jonathan Edwards.
key paragraph
No human being has ever had a more profound understanding of divine sovereignty than Jesus. No man ever prayed more fiercely or more effectively. Even in Gethsemane he requested an option, a different way. When the request was denied, he bowed to the Father’s will. The very reason we pray is because of God’s sovereignty, because we believe that God has it within his power to order things according to his purpose. That is what sovereignty is all about–ordering things according to God’s purpose. So then, does prayer change God’s mind? No! Does prayer change things? Yes, of course!
and conclusion
All that God does is for his glory first and for our benefit second. We pray because God commands us to pray, because it glorifies him, and because it benefits us.