Religion fulfills three basic purposes: It offers a 'catch-all' explanation for events that do not appear to make any sense, thus allowing people to preserve the integrity of their mental blueprint of how the world (should) work(s). If an innocent child gets cancer, it was obviously God's will. If bad things happen to good people it is a divine test. Stuff like that. It offers a framework of existential meaning in an apparently cold, dangerous and indifferent universe. If we think too much about how we are tiny, fragile specks going nowhere on a tiny fragile planet that could be wiped out any second, we'd go crazy. Religion is an attachment phenomenon: it promises a Big Daddy to who we really matter and who will look after us. The child dying of cancer will go to heaven. It's a secure base, a safe haven, and religious objects and rituals its transitional objects. It offers a framework for tribal and cultural bonding. It allows you to make a distinction between tribal members and outsiders, reinforces tribal rules, structures and cooperation and provides bonding rituals. For leaders, of course, it provides a framework for authority (as above, so below). To an extent philosophies like Communism or Humanism can do the same, but before science came along religion ticked all the boxes. And for most people, religion is easier to understand than science and more comforting. Science makes most people feel dumb. Religion makes them feel special.