Main Question: How does one create a realistic religion in a magical fantasy setting?
Oftentimes people want to include religion in their magical fantasy settings. I am one such person. However, I do not know how to do this in a convincing and serious way. If anyone understands how to craft religions, give religious backstories, or has expansive knowledge about the history religions on Earth that could be useful please help out with a post.
I like making general posts about specific topics that are a bit broad/vague so that they can help out more people rather than just me. I think that this could help out a lot of people. In many stories and even really famous anime/manga/LNs details about magic systems and religion are really left out! It's surprising how much they avoid details despite religion being integral to the main story at times.
I can't give you much advice on how to develop the religion itself, but I can try to give my take on how to work with the setting itself when you want to involve religion in it.
1)
In a medi-fantasy setting, Atheism should be inexistent. That's something people don't seem to realize, but... In a world without developed science, it's pretty much impossible to not believe in gods, the very concept of atheism was pretty much non-existent in medieval Earth. Now imagine Earth with magic, how will someone even consider not believing in a god in this setting?
Don't try putting an atheist character in your story, it just... Doesn't make sense, how will one explain the way the world works and the very existence of magic when they don't understand the science behind things? Saying it's God's will that makes things work just makes more sense.
2)
Incorporate small bits of religion in character dialogue. This is a small thingy, but like... If at any moment you feel like your character could say "geez" or "Jesus", just substitute that with "dear Gods" or something similar. It shows there is some degree of involvement with the character in question and with religion. The more often those phrases appear, the more religious the character would be... Saying stuff like "Gods help me" when they are troubled or the like could also be good.
3)
Decide early-on how much the gods can directly and indirectly influence the world. I personally dislike giving gods the power to directly influence the mortal world, because then I can only imagine how much trouble would it be when 2 countries with different religions went to war... There would be some big conflicts when miracles and blessings were involved and I can't imagine how much trouble that would be... Still, you can allow that, I just don't feel like it makes much sense.
In any case, it's important to be aware of what kind of things your gods can do, if they can send prophecies to oracles, if they can answer prayers, if they can send messages, if they can bring divine punishment to unfaithful believers, if they can give blessings to the primary believers, or even descend directly into the world themselves... Whatever you decide, it's better you decide the cans and can'ts sooner rather than later.
4)
Remember that religion probably has a lot of power and influence. Like... Countries with the same religion will often times be allies, and countries with different religions will often times be enemies, and religious wars shouldn't be that uncommon. In a similar vein, the higher echelons of the clergy probably have a big say on what the rulers of each country do.
5)
How many religions? That's a simple question you need to ask yourself. How many religions are there in the world? Does everyone belief in the same principles, but in different deities? Or does each country have a different religion altogether? Or does everyone have an unified religion believing in a single god and stuff?
Bear in mind that the more easily your gods are able to interfere with the world, the more likely it will be to have everyone believe in them... But that doesn't stop people from creating other religions, it just makes it more unlikely IMO.
You don't need to develop all religions you create though, they'll probably have different degrees of importance and you can just focus on the ones that have a bigger impact on your story. Nonetheless, it's good to know how many religions you want to work with.