That’s a very good question.
Religions have survived the centuries because they satisfy the basic human need for answers about the universe and our place in it. You see, religion is only possible in intelligent, thinking animals. God and religion are products of our own intelligence. Because our intelligence demands answers. And in the absence of science, that need was filled with what ever was at hand.
And at that time it was mythology, magic and superstition.
That line of thinking continues today’s because most people aren’t sufficiently exposed to an alternative way of thinking.
That religions can exist even though there is no god is self evident. Just look at all the competing mutually exclusive monotheistic religions existing at the same times. They can’t all be simultaneously true. Therefore most or even all of them are built on a god that doesn’t exist. And some of these religions have billions of followers.
But they survive because people are happy with the answers they provide as they have society and the weight of history behind them. And if a serious challenge is mounted the person behind it is often killed or imprisoned to eliminate the conflicting idea. Think the Spanish inquisition, Galileo, the Taliban and blasphemy laws.
In addition they are implanted in young minds before reason and logic can dispute them. Therefore they have precedence on their side.
Religion is about the unknown. And as our knowledge base grows the domain of religion will grow smaller and smaller. But there are areas of knowledge that science will likely never conquer. It’s in these areas that religions can continue their influence.
But only in minds that don’t have exposure to science, reason and logic. As evidenced by the inverse correlation between education and level of religiosity. Religions are strongest in third world uneducated populations and weakest in universities and educated first world populations.
The waning of religion is natural product of a liberal education.