In my setting, it's a five-stage process.
First, you need to know the requisite spells. They're all very high-level, specific spells that by and large are only known by demons. Demons are happy to trade you the knowledge of how to cast them, though - in exchange for your soul.
Second, one of the things you learn is that you need your soul. Demons are kind of dicks like that. You can live without your soul for a time, but you start to wither pretty quickly. Basically you cut your remaining lifespan down to about a tenth of what it was going to be.
Third, you need to kill a *lot* of innocent people via those spells you just learned. 100 is the minimum. The more people you kill, the stronger you'll be once you become a lich. 10,000 will make you become a virtual physical god. And, they NEED to be innocents. And their deaths will not be quick, nor painless.
Fourth, you need to get your soul back from that demon you traded it to somehow. Obviously the best way to do this is to not have to have traded your soul for the information to begin with, by learning how to become a lich through some other means. But that's hard.
Fifth, you have to die. But - and here's the kicker - you can't simply kill yourself, or ask someone else to kill you. Becoming a sapient undead is all about having a will so strong that you are pretty much willing yourself to stay alive at all times. By definition you *cannot* have that will to live if you're killing yourself, or getting someone to kill you. Basically you have to die while struggling as hard as possible to stay alive during it.
If you do all these things, then congratulations, you're a lich: an undead monstrosity, a creature of pure malice and evil and magical might that has to feed on a new soul every month or so or cease to exist.
There is no such thing as a Good or even Neutral lich - nor a bored one. A lich that ceases to have that animate willpower, that desire to keep existing no matter the cost, simply dies.