Yeah that's kind of a terrible subject in D&D. When you die one of three things will happen. The first is your soul hangs out where it was because it's trapped, maybe you turned undead, or resurrected fast enough nothing else happens. The other two options are merging into the plane of your afterlife in a sort of voluntary suicide of self and the other is becoming a petitioner. For good deities this is a special reward doted on exceptional believers making it pretty subjective on who gets what and as a continued reward they can even bump up their favor and turn into things like beautiful and pure unicorns. For the evil side through, Manual of the Planes is so full of examples of hundreds of petitions in hellish landscapes being tortured and abused against their will that I'm pretty much convinced merging with the plane is a secondary option people are deprived of until their mind collapses into unrecoverable insanity.
So you could go evil to pretty much guarantee becoming a petitioner so they can torment you. But since you'll probably want to end up on the Concordant Outlands so you can travel to other outer planes rather than being locked into one you can't actually sell your soul to a anyone. Pretty much everything is wiped upon becoming a Petitioner to a point wearing armor doesn't even alter your AC and even Boccob's pets are no longer called wizards or clerics so it's pretty dubious if you get to keep spellcasting. As a work around you do get to keep Extraordinary Abilities and the MM5 has a couple of monsters that are granted spellcasting from an Ex ability, otherwise you could try mailing your self some Magic Items when you die.
Go team evil?