In a theological debate, Richard Dawkins was challenged thusly: "Religious convictions are common; why have we evolved to believe in god?" He answered along the lines of reasons why humans get psychological and social benefits from religion.
I would respond differently. Humans haven't evolved to believe in gods, god has evolved to fit into humans' beliefs. We've seen a steady development of religious concepts, shaping themselves to fit into our understanding of science, etc.