Oblivion just does whatever it wants.
Indeed, I would love to just think that. But, I'm not that cool. Being hypocritical as I say this, we have to give some background to Oblivion. We must savor the few beneficial questions o' lore Oblivion
did give us.
to the point; There is a definite several factors that contribute to the presence of undead- But I'm going to only talk about the ones that
do have to do with lore, which cuts the number down to a few:
1. Necromancers. Necromancers are always in ruins and other interiors. Ayeleid and fort ruins have only a greater purpose of the deathly mages to lurk inside those abandoned halls. First off, in the first era, which is presumably when the Forts were built, (this is all off my head, so forgive my errors)-In the first era, Tamriel was the Arena, Me'thinks. The only reason for the Arenians to build such forts were probably to get a good defensive position. Defense=war/conflict, war=death 'n corpses. As for the Ayeleid ruins, the Merethic era probably.had some wars too, and, as before, war= death and corpses. In addition, Tombs are a popular feature to both Ayeleid ruins as well as forts, and as all of you know Tombs are where you put dead people, or corpses. All of those factors above contribute to the dense population of Necromancers in forts and Ayelied ruins. And, Necromancers tend, as is their namesake, to make the dead alive again. Undead, to put it bluntly, and then the Necromancers leave their manipulated walking corpses to stray and wander the forts and ruins.
2. As Dogsbody said, some spirits are bound to mundus. Some may stray and wander for eternity. Others maybe restless and appear as ghosts and Wraiths. the remaining choose to manipulate a carcass or two.
3. Pretty much everything that Axussridare mentioned. Bandits and other creature wander into the ruins. When they die, you pretty much go through way I said in to previous factor(2).
Liches, on the other hand, are a complete different story. Though game machanics state that Liches are a high level leveled undead, they actually have some differences all together compared to their mort-fleshen and skeletal cousins. A Lich appears as an undead, and, in some ways, are undead. Although not a term, the Lich may be considered Unliving-dead.
What I'm trying to convey is that Liches
are living dead, but they didn't go through the process of dyeing, then being reanimated, therefor not undead. Liches are theoretically elite Necromancers in they form of walking dead, they have nothing to do with factors 1,2, and 3(well, sort of related to 1). The only real way to depict whether or not Liches are truely undead is to look at the process of becoming a Lich. Even with that looked at I could go on for hours typing a philosophical lecture on whether they're dead or not.
As there are many versions of the process to lichhood, Bethesda has not officially released the correct way to become a lich in TES's perspective. Though in my opinion, I believe that M'Aiq is correct:
"You wish to become a lich? It's very easy, my friend. Simply find the heart of a lich, combine it with the tongue of a dragon, and cook it with the flesh of a well-ridden horse. This combination is certain to make you undead."
Although it is hypocritical, as M'Aiq refers to a Lich as being undead. Though he does not specify whether or not to eat the concoction.(and yes, I'm aware of M'Aiqs conceled joke in the dialog)
Sorry, I tend to trail off, but never really this much...