Petitionary Prayer, otherwise known as asking for stuff, is a bit of a problem for the classical notion of God. If God is omnipotent, omniscient and omnibenevolent, then we have some issues. If God knows all future events, then we have a serious breakdown in coherence.
Let me start off by establishing the context. If we have the classical version of God, the one most adhered to by theist, then we have a god who knows everything. Everything that was, is, and ever will be. God knows all the counterfactuals (if this happens, then that happens) and he knows the outcomes of all supposedly freely willed decisions. He is all powerful, so can do anything (within logical parameters, arguably). He is all-knowing, so knows what to do in any given scenario, as well as having his divine foreknowledge. He is all-loving, and so will want the most loving outcome for any given scenario (in some way – overall, for example).
As I have argued before, this plays merry havoc with those theists and their ideas that God has free will. He is actually fully constrained by those omnis. He cannot act outside of his omnibenevolent remit for fear of invalidating that label.
So when Betty prays for something to happen, and thing is going on. In the layperson’s head, this is happening:
Dear God, I really want [insert desire, e.g. to win the lottery], so please can you make this happen because I am your loving follower in Jesus’ Christ’s name.
This can also be seen like this:
Dear God, I really want [insert desire, e.g. to win the lottery], so please can your change you mind from what you had originally intended to make this happen instead because I am your loving follower in Jesus’ Christ’s name.
In reality, this doesn’t happen:
Dear God, I really want [insert desire, e.g. to win the lottery], even though I know you have everything laid out in a careful plan and know that this petition to you, if it does not already play out in the context of your omni-ness, is pointless because it’s not like you’re going to change your infinitely more complex and knowledgeable mind. So please can you make this happen because I am your loving follower in Jesus’ Christ’s name.
Though it might be a common appeal if seen in this format:
Dear God, I really want [insert desire, e.g. to win the lottery], but I suppose this is pointless, so this is really just a voclised hope that I am already in that reality where the thing I want is the thing I am going to get… because I am your loving follower in Jesus’ Christ’s name.
And this could be translated further to this:
Dear God, I am praying because it makes me feel better and makes me think I have a greater chance of getting into heaven. Also, I like the company. Oh, and if I don’t pray, you might get real angry, and these threats work at some base level. Finally, I do actually deserve all the stuff I want because, well, me.
It’s worth referring to these “Pray for Paris/London/Manchester/Las Vegas” nonsense memes. Praying might make the praying person feel better, but it will do stuff all to affect anything else, because God will already have the most loving scenario playing out, if his omnis are to be believed.
One argument you see is that prayer is useful going back into the past. God could see you pray at point t=0 and know this in advance of creation and this can affect his decision to do something at point t=-10. Of course, we then get into weird, potentially infinite loops of ramifications working in both directions.
In short, prayer will never change God’s mind, of that I am pretty certain, given a classical theistic god.