One theory about organized religion is that it started from dreams.
Imagine ancient humans, tens of thousands of years ago. As these hunters and gatherers lay their tired bodies inside a cave, they fall into sleep. Then, they start dreaming. They see absurd visions while deep in slumber. Sometimes, they dream of wild beasts chasing them. Sometimes, they dream of strange lands. And then, sometimes, they dream of loved ones and friends who have already passed away.
They would see visions of dead people: talking to them, eating with them, hunting with them. Then, they would wake up—-wondering about what they saw. They would ask questions: Why did I see my mother who died a long time ago? Why did I see my friend who was devoured by lions two sunsets ago? Where are they? What do these visions mean?
These dreams ignited beliefs in the transcendent—-that something exists beyond the material and physical world. That there is something else out there, something— or rather someone—- who we cannot see nor touch, but can see us and everything around us. These people may not have the linguistic sophistication to verbalize such ideas, but their minds —-though untutored —- tried to process such visions. These dreams sparked philosophical thoughts about life, existence, death. They sought answers to their questions. How could someone who has passed away be able to show himself to me? How could someone whom we buried or burned to ashes be able to appear in our mind? Something from a man must continue to exist even if he dies—-they mused. And in the absence of explanations from learned people (like modern psychologists and psychiatrists), ancient humans eventually attributed special capabilities to these dead people appearing in their dreams.
They started believing that deceased ancestors may have supernatural powers that enabled them to come back and appear in the mind of the living. They also became convinced that the dead have the power to hear supplications and grant wishes. And so, “ancestor worship” was born. Ancient humans started revering and worshipping the dead. They began constructing elaborate burial sites, and making offerings such as flowers and animal bones. Burial sites were transformed into sacred places of worship.
And as the centuries and millennia went on, human societies evolved. And part of our evolution is the development and organization of the different religious institutions that we now have.