Of all the many courses of action or inaction, a perfect God always picks the best one. This appears to makes prayers ineffectual. If one prays for a friend to miraculously recover from an inoperable brain disease, what will happen? The prayer cannot make a difference, because, God has already picked the best course of action. If the prayer is successful, it's because God was already going to move that way. If it was unsuccessful, then, God has a better plan. It seems that to pray for God to act is to doubt that God already knows best1,2.
To pray to change something is to oppose God, to make a statement that you think you know better! To pray is insolent, ignorant, misguided, confused - but most of all, arrogant. By trying to sway God's mind through prayer, you are behaving in the same way as that apostle - with Satan guarding behind you! The only theologically wise way to pray is in a meditative manner, where the principal purpose is to condition yourself. Religions that openly use meditation, but not prayer, have a better approach to truth.
As the 19th century dawned, these thoughts were echoed by several freethinkers, who became famous for the rational analysis of religious ideas:
“For what is the amount of all his prayers but an attempt to make the Almighty change his mind, and act otherwise than he does? It is as if he were to say: Thou knowest not so well as I.”
"The Age of Reason" by Thomas Paine (1807)1
“The Eternal has His intentions from all eternity. If prayer accords with His immutable wishes, it is quite useless to ask of Him what He has resolved to do. If one prays Him to do the contrary of what He has resolved, it is praying Him to be weak, frivolous, inconstant; it is believing that He is thus, it is to mock Him. Either you ask Him a just thing; in this case He must do it, and the thing will be done without your praying Him for it; entreating Him is even to distrust Him: or the thing is unjust, and then you outrage Him.”
"Voltaire's Philosophical Dictionary" by Voltaire (1764)2
Modern theologians are still confounded by the contradiction between God's perfection and prayer:
“Many systems try to explain how human freedom and human action are consistent with God's omnipotence and omniscience. None succeed. [...] But there is no practical doubt that they are compatable. And so it is with the action of man on God in prayer. [...] We cannot change the will of God, which is grace [...] but we can change the intention of God, which is a manner of treatment, in the interest of grace, according to the situation of the hour.”
"The Soul of Prayer" by Peter T. Forsyth (1916)3
You can be forgiven if this theologian's answer to the problem doesn't seem to make sense to you - he himself admits in the same text that it is "not rationally plain" how Human prayer and free will exist alongside a Universe dominated by God.
When you pray, the words and thoughts are believed to achieve potential results. This is no different from a wizard or a pagan casting a spell and some books routinely include prayer when discussing magic4. It is supernatural because the effect is not achieved through the physical laws of nature that can be investigated through science. Magic is simply a form of supernaturalism bought about via ritual or spoken words. Magic is not taken seriously by scientists, academics, skeptics nor the general populace. Despite amazing and great advances in physics, quantum physics, psychology and neurology, no possible basis for "magical" actions has been found by researchers. All sociological investigations have found no evidence of real magical power, and parapsychological and occult experimenters have never been able to formulate proof that satisfies basic scientific requirements such as independent verification and impartiality. So, in the modern world, all major religions disclaim themselves against magic and say that they don't practice it. Ask a Christian if praying to heal someone is magic, or a Muslim if the healing ruqyah is magic, and they'll vehemently deny it. 5
Many others would call it magic. The actual method by which a ritual works is unknown. It is the same with prayer: When people think that prayer has been successful, they ascribe the cause and effect of it to God. But this cause and effect could be any supernatural phenomenon, such as telekinesis or psi. It could be that the spirits of the dead carry out the wishes of a Christian who prays (therefore, folk religion is true, and Christianity is false). It could be that everyone, including Christians have spiritual animal guides, and that these oversee people's wishes and prayers, and go forth and make some such wishes actually happen. We don't know if spells, prayers, rituals, and wishes are made effective by quantum souls, gods, fairies, or demons. If they work via a God, then, we simply don't know which God is doing the granting. We simply do not know what happens; hence, prayer is not only supernatural but it is magic. When religious people hear how other people explain these effects, they turn into hardcore skeptics. It is magic, and, magic is daft. But when they are talking about their own magical pursuit, known as prayer? Well, in this case, they think, it is not magic, and it is not daft! But how does it work? They still don't know. There is no different between the magical words of prayer, and any other form of magical word. Prayer is magic.
For more, see:
If theistic prayer is a quagmire of mixed-motives and confused theology, and prayer itself is more akin to magic (if it works) or meditation, and together is only a challenge to God's plan, what says those who do challenge the concept of God on purpose rather than by accident?
“The Satanist shuns terms such as "hope" and "prayer" as they are indicative of apprehension. If we hope and pray for something to come about, we will not act in a positive way which will make it happen. The Satanist, realizing that anything he gets is of his own doing, takes command of the situation instead of praying [...]. Positive thinking and positive action add up to results.”
They seem, quite aptly, to use the failures of prayer as a concept as motivation for taking actual action themselves in order to change the world.