It took me a long time to realize that cleaning walls prior to painting was a pretty big deal. I always viewed it as an unnecessary step prior to painting.
As it turns out, cleaning the walls is part of the painting process.
Zinsser's cover stain products do a fairly good job of covering the stains, but not always. Sometimes, the stains are far too nasty to be covered even by stain-blocker.
TSP, mentioned by Alex Nice in this video, is the classic way of removing hard-to-remove stains. Personally, I like the stuff (it's dirt-cheap), but it's not the end-all, be-all of stain removers.
Check out Alex' multi-pronged approach to removing stains from walls prior to painting.