Recently when I was out taking a walk, I met an older man I sometimes see. I think he's an atheist. Usually he doesn't say too much but that day he started to tell me why prayer is useless. He thinks that religious people think they should just pray for things and expect God to do everything for them instead of working.
In the past I usually just listened to him, but I felt that the time had come to respond in some way. After he finished, I tried to respond but he immediately cut me off and said I didn't understand (I don't know how he could say that since he didn't listen to my response). After going through this three times, I just bid him good day since he didn't want to discuss it, but just harangue me.
Anyway I went back to see what Thomas says about prayer. He says that Divine Providence disposes not only what effects will take place, but what causes will bring about those effects. In God's plan, our prayers are an important "cause" that God wills to use in order that certain other things should happen. (Summa, I, q. 83, a. 2).
Prayer doesn't mean that we just sit back and expect God to do everything without our efforts. Instead, prayer is something we need to do along with our own efforts. That saying which I think comes from St. Ignatius says it all: "Pray as if everything depends on God; work as if everything depends on you."