The notion of petitionary prayer is philosophically controversial. I understand 'petitionary prayer' to consist in asking God to do various things, such as providing us with our daily food, or saving some other person from her sins, etc. The philosophical problem is this: if I am asking for God to do something bad, then of course he has sufficient reason not to do it; but if I am asking for God to do something good, then doesn't he already have reason enough to do it, independently of my asking? What good is there in my asking God to do it? Why bother?
I want to offer an answer to this question by drawing from my recent reading in Catherine of Siena's Dialogue. Specifically, I am going to address the question of praying for the salvation of other persons, which we are called to do (1 Tim 2:1-4).
Catherine makes the point that, as far as our life in this world is concerned, "we are all in it together," like Bernie Sanders says. She uses the image of a vineyard as an analogy for the soul:
Keep in mind that each of you has your own vineyard. But everyone is joined to your neighbors' vineyards without any dividing lines. They are so joined together, in fact, that you cannot do good or evil for yourself without doing the same for your neighbors (24).
So any action that we perform has a double effect: first, it affects us either positively or negatively, depending on whether it fosters love for God and neighbor or else it separates us from these; and second, it affects our neighbor in some positive or negative way, also. Interestingly, God suggests to Catherine that he has made things this way because our love for God can only be perfected in our love for our neighbor. Consider the following longer quote:
I ask you to love me with the same love with which I love you. But for me you cannot do this, for I loved you without being loved. Whatever love you have for me you owe me, so you love me not gratuitously but out of duty, while I love you not out of duty but gratuitously. So you cannot give me the kind of love I ask of you. This is why I have put you among your neighbors: so that you can do for them what you cannot do for me -- that is, love them without any concern for thanks and without looking for any profit for yourself. And whatever you do for them I will consider done for me (64).
In other words, our neighbors function as the means by which our love for God can be demonstrated and perfected. God wants us to love him like he loves us, but this can't happen: he loves us gratuitously and without concern for repayment, but we love him out of duty. Therefore, he provides us with our neighbor, so we can demonstrate that same kind of love that God has -- utterly selfless and disinterested in gain -- and God considers it as having been done for him!
So God has set up the world in such a way that we cannot escape responsibility for our neighbors. There is no two ways about it: you must love your neighbor if you are going to show God the kind of love he expects from you. Effectively he has laid this responsibility on everyone: to love one another selflessly, without interest in gain or profit.
But where does prayer fit in? God elaborates to Catherine at length the ways in which people in this world misuse their free will, and rather than seeing their pains and sufferings as opportunities to develop virtue, trusting that these have come upon them out of God's goodness and his love, instead they react out of selfish desire. They seek the pleasures of the moment, which have been disguised by Satan as representing the true good when they actually do not. And though people have freedom of the will to repent of their evils so long as they are in the body, yet so many of them do not because they have been blinded by sin and by evil, through habitually living in darkness.
Now, Catherine affirms that it is compatible with God's justice and goodness that he leave these persons as they are, so that they should suffer the right consequences for failing to love God. The prime consequence, of course, is eternal damnation. It is right that they should suffer damnation for this, because they have sinned against the infinity of God's goodness and have utterly shut themselves off to the true values; they are merely reaping what they have sown. But God also wants to have mercy on the world. And so he calls upon his servants to pray for sinners:
You, my servants, come into my presence laden with your prayers [for sinners], your eager longing, your sorrow over their offense against me as well as their own damnation, and so you will soften my divinely just wrath. ... the medicine by which [God] willed to heal the whole world and to soothe his wrath and divine justice was humble, constant, holy prayer (19).
We can see, then, the connection between prayer and love of neighbor. God invites us to pray for each other because in this way, we will be taking responsibility for each other, and thus demonstrating our love that God desires and expects of us. At the same time, it is not as if God would be obligated to intervene in the lives of others with increased grace already, because it is sufficient for his justice to leave people in their sin as they've chosen. It is already open to every person to repent and to be saved, given the conditions in which she actually lives; if God provides any further grace thanks to the prayers of some of his servants, he is going beyond what is required.
At the same time, it would seem God has reason not to intervene with special grace for sinners all the time, even if no one asked. After all, if no one had to ask for it, then our love for one another would grow cold and uninvolved: I don't have to worry about your salvation, because God is already going above and beyond the call of duty regardless of whether or not I pray. In other words, to believe in the inevitability of these special graces is profoundly demotivational; it saps us of any real zealous drive and yearning to take personal responsibility (in whatever limited measure we can) for the salvation of others.
So why should we pray for others? Why should we petition that God save others? Because God has made us such that "we are all in it together," and he wants us to love one another. God wants us to be concerned for one another and to take responsibility for one another, and therefore he leaves it up to us to petition him for the salvation of sinners. He would not be doing wrong, nor would it be a compromise of his goodness, if he were to leave sinners as they are: after all, they are freely choosing to refuse the graces he is already offering them, and it is always open to them while they are in life to repent. But he is willing to go far beyond what is required of him, and even beyond what his goodness would otherwise demand, if we ask him to do so, with tears and zealous fervor. If he were always to do this anyway, however, we would lose any motivation whatsoever to pray.
This has general application to the problem of evil. Why doesn't God intervene to stop every single evil thing that happens? One answer is this: the presence of evil offers us an opportunity to develop virtue -- for example, courage in risking death to help others in need during an emergency -- and virtue, being likeness to God, is far more valuable and good than pain and suffering are bad. If God stopped every evil before it ever happened, we would have no occasions to develop virtue freely. God takes a somewhat "hands off" approach precisely so that we can get our hands dirty, by taking responsibility for one another.