I disagree with ANTMakko that religion was begun as a form of social control. I certainly believe that some people have since used it as such. But that's a whole other string of nodes.

Personally, I feel that all human beings have certain unanswered questions about the way the world works. Why am I here? Why do bad things happen? Is there some meaning to it all? It's extremely discomforting to think that there might not be any answers. Thus, the human brain, in its infinite wisdom, decided that all will become clear after we die. The psyche introduced this concept as a pacifying mechanism to prevent itself going insane.

Later, the concept got formalised and handed over to a bunch of corrupt Italian guys (in the case of Christianity) and whatnot, and everything went screehee. But it was a nice thought.