This is a part of worldbuilding that is glossed over by a lot of fantasy writers.
I think that this is as important as the history and languages of your world. Overlooking this takes away from the realism of your world. It makes your characters one sided. I’m not saying that you need to obsess over religion for your fantasy world, but you do need to give it it’s due.
Why do I say this?
First of all, most fantasy worlds are set in a medieval period. The society is primitive. People in such societies are superstitious. Things like religion and gods loom large in their lives. The authors of most fantasy books however are all born in the 20th century. Their readers are also born in the 20th and 21st centuries. Thus the readers world view is modern. Naturally they identify more easier with people who they have things in common with. Thus authors both voluntarily and involuntarily make their worlds and characters confirm to the modern world view. It’s incongruous to see a character from a small farming village looking at the wider world and judging it with a 21st century world view. Even more so when the author validates them.
Even the world we in today, in 2016, there are people who believe in and shape their lives by superstitious belief and archaic tradition. Arranged marriages are common even today in some countries. And most of them consider horoscopes, caste, ethnic and religious factors. Caste and class systems are still practiced in some places. This was even more prominent in ancient times. Religion dominated peoples lives. Tradition bound them. And they didn’t really have an issue with it. It was the life they knew. Some fantasy authors might say that their world was home to an ancient advanced civilization that introduced modern views into their world and they were handed down and remained even after the fall of the ancient civilization, but they underestimate how quickly people can forget and move on. The philosophy of a thousand year old empire would not survive in a feudal world. Ancient Greek teachings were well and truly lost till the renaissance, and even then they only found purchase among a small group of people. And remember that they faced opposition and accusation from society for their views. Galileo Galilee was almost set on fire for saying that the world was round. This is the kind of reception the hero can expect when they question the traditions and gods of a fantasy people.
What would the beliefs of a fantasy world inhabitant be?
The Afterlife: Every people in our world has a story of what happens after they die. This is a very important question and occupied a huge chunk of a persons world view (This hasn’t changed). Unless your fantasy world is populated by immortals or the afterlife is easily accessible, this is a question you should answer for your world.
The Religion and it’s prominence: I’ve said it earlier, religion loomed large in the minds of ancient peoples. People went on crusades for religion. People made life changing decisions on the advice of a priest. And by life changing I mean farmers married off their children and kings withdrew from battle on the word of a priest. Any fantasy world with a religion in it would have at least some of this. Remember, for the reader the religion of the fantasy world is fiction, but for the characters it’s very real.
They would have more than one religion: The amount of fantasy worlds that are divided into one race – one religion blocks are far too numerous. This happening is highly unlikely. Just look at the religious demographic of any one nation in our world. Look at the amount of religions in our world that have fallen out of practice. No one worships the Roman Gods anymore. The religious landscape of the world is as complex as the political landscape. Much like nations, religions rise, religions fall, religions conquer and religions are divided.
A world would have more than a single set of beliefs: In a low tech world, traveling from one place to another was a daunting prospect. Geography divided people a lot more than they do today. And with division came their own unique identity and beliefs. There are numerous creation myths and afterlife theories around in Europe alone. This is another thing fantasy worlds are terrible at. A world where every single nation and people believe in the same prophecy cycle and every single myth and legend converges around the same prophesied champion is very hard to swallow. A fantasy world with a long history would have a more detailed system of beliefs. And they might come up in the story. For example as the hero and co. go on their inevitable journey, they might be exposed to numerous beliefs in the towns and villages they pass through. Or they might have to work around local superstition as they work with a new acquaintance.
The gods might be real: This being the fantasy world. The gods (and other supernaturals) might just be very real and active in your world. Someone might have actually sent a message back from the afterlife and given their living relatives a preview. In that case you need to work that into your world carefully. Does everyone believe in the afterlife? Have disgruntled people invented fake gods to worship because they have lost faith with the real ones?
This is not a comprehensive list. But these are things I feel authors should pay attention to in order to write better, more realistic fantasy.