A fantastic article by John Piper on the Desiring God website:
A Conversation between Prayer and Prayerless:
Prayerless: I understand that you believe in the providence of God. Is that right?
Prayerless: Does that mean you believe, like the Heidelberg Catechism says, that nothing comes about by chance but only by God's design and plan?
Prayerful: Yes, I believe that's what the Bible teaches.
Prayerless: Then why do you pray?
Prayerful: I don't see the problem. Why shouldn't we pray?
Prayerless: Well, if God ordains and controls everything, then what he plans from of old will come to pass, right?
Prayerless: So it's going to come to pass whether you pray or not, right.
Prayerful: That depends on whether God ordained for it to come to pass in answer to prayer. If God predestined that something happen in answer to prayer, it won't happen without prayer.
Prayerless: Wait a minute, this is confusing. Are you saying that every answer to prayer is predestined or not?
Prayerful: Yes, it is. It's predestined as an answer to prayer.
Prayerless: So if the prayer doesn't happen, the answer doesn't happen?
Prayerful: That's right.
Prayerless: So the event is contingent on our praying for it to happen?
Prayerful: Yes. I take it that by contingent you mean prayer is a real reason that the event happens, and without the prayer the event would not happen.
Prayerless: Yes that's what I mean. But how can an event be contingent on my prayer and still be eternally fixed and predestined by God?
Prayerful: Because your prayer is as fixed as the predestined answer.
Prayerful: It's not complicated. God providentially ordains all events. God never ordains an event without a cause. The cause is also an event. Therefore, the cause is also foreordained. So you cannot say that the event will happen if the cause doesn't because God has ordained otherwise. The event will happen if the cause happens.
Prayerless: So what you are saying is that answers to prayer are always ordained as effects of prayer which is one of the causes, and that God predestined the answer only as an effect of the cause.
Prayerful: That's right. And since both the cause and the effect are ordained together you can't say that the effect will happen even if the cause doesn't because God doesn't ordain effects without causes.
Prayerless: Can you give some illustrations?
Prayerful: Sure. If God predestines that I die of a bullet wound, then I will not die if no bullet is fired. If God predestines that I be healed by surgery, then if there is no surgery, I will not be healed. If God predestines heat to fill my home by fire in the furnace, then if there is no fire, there will be no heat. Would you say, "Since God predestines that the sun be bright, it will be bright whether there is fire in the sun or not"?
Prayerful: I agree. Why not?
Prayerless: Because the brightness of the sun comes from the fire.
Prayerful: Right. That's the way I think about the answers to prayer. They are the brightness, and prayer is the fire. God has established the universe so that in larger measure it runs by prayer, the same way he has established brightness so that in larger measure it happens by fire. Doesn't that make sense?
Prayerless: I think it does.
Prayerful: Then let's stop thinking up problems and go with what the Scriptures say. Ask and you will receive. You have not because you ask not.