The Atheist Perspective

Prayer is simply a psychological behavior that makes people feel better. It has no other actual function or effect.

Religious experience is a highly diverse subject, in which people "experience" entirely different and ultimately contradictory gods and goddesses and spiritual messages and sensations across the span of history and cultures.

All experiences that have been adequately studied with sound scientific methods have been verified to be internal psychological events, often of a delusory or psychosomatic nature, in which a person subconsciously convinces themselves of what they most want or need to believe at that moment in their lives, highly influenced by the power of suggestion and assumptions implanted in them by their culture.

This is why no one ever has a religious experience of Jesus unless they are first taught about Jesus and told what to expect of him, while people in other cultures experience entirely different gods in exactly the ways their own cultures tell them to. Much of the science behind this is discussed in Daniel Dennett's book Breaking the Spell. He is a cognitive scientist who specializes in conscious experience and the brain, and his book on this is well worth reading.

The Straight Dope about Prayer