In an article in The New Scientist titled Born believers: How your brain creates God (subscription required), Michael Brooks says:
There is plenty of evidence that thinking about disembodied minds comes naturally. People readily form relationships with non-existent others: roughly half of all 4-year-olds have had an imaginary friend, and adults often form and maintain relationships with dead relatives, fictional characters and fantasy partners. As [University of Oxford anthropologist Justin] Barrett points out, this is an evolutionarily useful skill. Without it we would be unable to maintain large social hierarchies and alliances or anticipate what an unseen enemy might be planning. “Requiring a body around to think about its mind would be a great liability,” he says.
Useful as it is, common-sense dualism also appears to prime the brain for supernatural concepts such as life after death.
…
[Queens University, Belfast’s Jesse] Bering considers a belief in some form of life apart from that experienced in the body to be the default setting of the human brain. Education and experience teach us to override it, but it never truly leaves us, he says. From there it is only a short step to conceptualising spirits, dead ancestors and, of course, gods, says Pascal Boyer, a psychologist at Washington University in St Louis, Missouri. Boyer points out that people expect their gods’ minds to work very much like human minds, suggesting they spring from the same brain system that enables us to think about absent or non-existent people. (my italics)

