In this world is divided into four realms with each being inhabited by a different species. There is the living world with humans, purgatory with undead, heaven with angels and hell with demons. They are all connected by Energy wich runs through every living being in some way. When it gets a personality and a mind of its own a soul is created and every human has a soul, its what gives them life and keeps them from being empty shells and it gives demons fuel to grow and become stronger.
when humans die their soul travels through purgatory where it gets purified. that means the personality and memories get stripped from it turning it back into energy wich then gets redistributed back into the living world by the angels. Angels do not have a soul or feelings. Their only purpose is to serve the cycle and protect it and their appearance is hard to comprehend for any mortal. Purgatory isnt technically a full realm but more of a mirror image of the living world which immediately splits any soul from its host that enters. Nothing alive can exist there not even plants and it looks exactly like an empty version of its counterpart so it mainly functions as an in between or a gateway than a world with true habitants. Altho it is possible to live in it.
The reason the cycle needs to be protected in the first place is because of the demons. They feed of souls to gain power and while they dont strictly need energy to survive every one of them has an inner longing for it. And the only way to obtain them is to enter the human world and hunt.(there are multiple ways to go about it, killing, possession and contracts but ill go into more detail in the demon chapter). consumed energy is no longer part of the cycle meaning it can run low wich is where the angels come into play again. When they sense that the demons are taking overhand and hells is expanding too much they will interfere by basically purging half its population. Of course they werent happy about that but since you cant kill angels your only option is to prevent the situation from happening in the first place.
So some of the high ranking demons had the idea to make use of a strange phenomenon everyone had largely ignored before. On very rare occasions the soul of a human doesnt get purified when entering purgatory and remains sentient. They are stuck between life and death wich means they gain some interesting powers. While they cannot be truly alive again they can re enter the living world by using corpses as vessels. These people are called "undead". So since they didnt have anything to do anyway the demons employed them as exorcists to try and get as many low ranking demons out of the living world as possible. They are perfect for the job because of their unique skill set and the fact that they are more reliable and trustworthy but its very dangerous and unpleasant for the undead. they dont exactly have a choice though.
And so the cycle keeps going. But No one knows what would happen if the energy would run empty except for the angels.