Religion is part of society. It is a social institution which serves to guide people in all walks of life.
The most important concept of religion is god; an all encompassing all powerful entity that is our creator and destroyer. In some religions there is only one god. Others have multiple deities together called a pantheon.
Religion provides people a given set of rules on how we should live our life. These rules decide what is morally acceptable or right and what is wrong. This creates a limited number of choices and limited freedom to decide our own fate. However, contrary to what you think, this actually works very well. Our brain works on a minimalist philosophy. The less choices we have to choose from the less decision fatigue, the better.
Religion either through the concept of god or in some other way provides a reliable companion. Human beings are social animals, many a time we feel lonely which causes us to crave for attention. When we do not get attention we become depressed. This constant cycle of being lonely and then craving attention causes fear and distress in the minds of people: hence they reach out to religion. Religion provides a reliable companion in the form of god who will listen to their woes and give them company.
Our brain works on a cause-effect basis. When we look at something, we immediately try to explain it. When we look at the world, we try to explain how it was made. When we look at ourselves, we question our very purpose of existence. These are no easy answers to these questions but religion provides a simple answer; because God wished it so.
Hence religion is very appealing and has powerful impact on people’s lives.