How and why did religion evolve?

Even chimps show some spiritual behaviours, suggesting religion has deep roots