The 1969 protest song "War" asks "What is it good for?" and answers "Absolutely nothing!" If I substituted "Prayer" for "War," I would qualify my answer with "Almost nothing."
Prayer can be good for its placebo effect when believers feel they are doing something constructive, which might "cure" a psychosomatic disorder. On the other hand, replacing accepted medical practices with prayer has led to countless preventable deaths and injuries.
Many well-meaning people rely on prayer because it makes them feel upbeat when they don't know what action to take in a situation that is out of their control. Regardless of logic and statistical evidence to the contrary, fervent believers remain convinced that there is a god who listens to prayers. I've heard comments like "Sometimes our prayers are answered and sometimes they are not" and "God answers all prayers, but sometimes the answer is no."
Prayer can also be good for providing a sense of community to those who hope to achieve a desired outcome. But such prayers might not always be for outcomes beneficial to all, as depicted in Mark Twain's "The War Prayer," a prayer for the suffering and destruction of enemies, as typified by "O Lord our God, help us to tear their soldiers to bloody shred." This "prayer" was left unpublished until years after Twain's death because his family considered it too sacrilegious.