If everything that happens is God's will, why should we pray?
It’s true that everything that happens falls under God’s providence (see Summa Theologiae I:22:2). But rather than this being an obstacle to prayer, it is actually the rationale that justifies prayer.
God’s providence involves not only willing certain effects to take place but also willing the causes by which those effects will be brought about—that is to say, God wills a pattern of cause-effect relationships.
Now, the eternal decree that determines which causes will bring about which effects includes human acts. These actions do not change God’s plan, but they are an essential part of it. In the words of Aquinas, “[They] achieve certain effects according to the order of the divine disposition” (Summa Theologiae, II-II:83:2).
Prayer is simply one human action among many that God wills to be a cause of certain effects in his divine plan. As Brian Davies explains, “God may will from eternity that things should come about as things prayed for by us” (Thinking About God, 319).
In other words, it’s possible that God wills some events to occur only as a result of our prayer. Whether we know the effect is conditioned by our request or not doesn’t matter. The point is, it’s possible, so we make the request hoping that God wills our prayer to be a cause of the effect. If it turns out he did not will it so, then we trust God has good reasons for his choice. This is why Christians pray “Thy will be done.”
But if it turns out that God wills our prayer to be a real cause of an effect, then it would be true to say that our prayer makes a real difference, being that God wills it as an essential part of the cause-effect pattern that God has eternally decreed.
For more details on this subject, see my article “Pointless Prayer or Gracious God?”