Religion, based on my studies seems to be a spandrel from the evolution of man's mental capabilities. The source of religion is in the religious experience, which seems to be best understood as images/sensations the brain creates that are not actually present (This is easy to test on yourself by sense deprivation or over-exposure). Humans then take these images/experiences and use them , through their own cultural interpretation, as a source for identification. Identification is socially used for the evolutionary advantages of ingroup cohesion and outgroup hostility.
To me that sums it up.
For a list of texts, here are some:
David Sloan Wilson- Darwin's Cathedral
David Lewis-Williams- The Mind in the Cave
Kevin Seybold- Explorations in Neuroscience, Psychology and Religion: Ch. 6 Brain and Religion
Scott Atran & Ara Norenzayan- Religion's evolutionary landscape: Counterintuition, commitment, compassion, communion
Pascal Boyer- Why Do Gods and Spirits Matter at All
Lee A. Kirkpatrick- Attachment, Evolution, and the Psychology of Religion: Ch 2 & 3
Stewart Guthrie- Animal Animism: Evolutionary Roots of Religious Cognition