In taking what Kevin has stated, given that consciousness was an evolutionary adaptation for survival, could it be that the creation of religion and gods are a “side effect” of this adaptation?
The God Effect is part of the whole-of-life historical evolutionary development of the animal herd mentality, within which structure and an interpersonal hierarchical value system must exist.
As animals brains evolved past the simplistic instinctual style social interrelationship of reptilian behaviour, and became able to conceptually encompass, even if just marginally, the concept of "future". With this the animals brain would also be able to acknowledge, via conscious thought, the danger taking one action over another. When these choices relate everyday herd activity the beast learns that subservience to more powerful herd members, pays off. The time for non-subservience is mainly just during the mating session when hormones rage. The fittest breed primarily with the fittest, but all breed. Over time this has the effect of stretching out the physical, and now mental, variety within the species.
With this physical/mental variety, in mammals particularly, the beasts brain can understand the relative degree of power of other herd members. A hierarchical value system can form. The one at the top of the value chain becomes leader.
Leadership evokes additional responsibilities of herd management. Mostly this occurs via displays or actions of physical power or ability towards other herd members. The most successful leaders will be those who can most consistently achieve this without injury, and this takes mental capacity. By selection, the genetic pool for leaders will continually produce the best of the best potential survivors, and they will take into their future more of the most beneficial mutations of other herd members. This effect could even occasionally lead to species division, with sufficient isolation and environmental change.
The better the skill of the leader to safely lead, the more the herd will become subservient to the herd leader, and others higher in the hierarchy. Over time the species subservient nature, although it already exists in an instinctual capacity in relation to physical power, will also become a mental trait, genetically passed on.
The human brain has this animal herd-ness, we are primates, but we also have a concept of awe in, and intrigue about, nature, as well as a brain powerful enough to enable imagination, and a wide array of emotions. Within our human brains these things are all brought together, intertwined, and we create gods and religions as a result.