A coat of primer may seem like an unnecessary expense, but when painting interior walls, it's almost always worth it. You should never omit primer when painting new drywall, and it's also a benefit over existing glossy or semi-gloss paints. You also need primer when painting over wallpaper -- whether porous or not -- and wood paneling -- whether finished or not. Primer usually isn't needed when you're painting over flat wall paint.
Types of Primers
Primers come in oil-based, shellac-based and water-based blends, but because of the large amount of VOCs they release, the first two aren't suitable for interior use. Primer looks and spreads like paint, but it contains a higher concentration of solids as well as an adhesive binder -- the binder in drywall primer is polyvinyl acetate, the same adhesive in carpenter's glue. Wood primers -- especially shellac-based ones -- block stains as well as filling wood pores and sealing the grain. This is important when you need to cover smoke stains or prevent bleed-through from knots and resin pockets in wood paneling.
New and Previously Painted Drywall
Priming new drywall is always recommended, because the primer seals the paper and drywall mud. Both of these materials are porous and absorb paint at different rates, and if you omit the primer, you'll never be able to produce a uniform topcoat. Primer is optional on previously finished walls, but it's a good idea to use one if the finish is glossy or covered with a greasy film. If you are painting in an old house, and you suspect the existing paint is oil-based, prime with a latex primer to ensure adhesion of the latex topcoat.
Wallpaper and Wood Paneling
If you're painting over wallpaper, whether vinyl or paper, you should apply a coat of primer. Paper wallpaper absorbs paint much like new drywall and needs a coat of PVA primer to ensure a uniform topcoat. Vinyl wallpaper isn't porous, but it needs PVA or shellac-based primer to ensure paint adhesion. The same is true for finished wall paneling; after de-glossing the paneling with a solution of trisodium phosphate and water, apply a coat of primer to prevent the topcoat from peeling or bubbling. Use shellac-based primer before painting unfinished wood paneling -- it seals the wood grain and prevents bleed-through.
You don't have to prime the entire wall when painting over previously painted wood paneling, but you should spot-prime with shellac-based primer to cover tannin stains or smoke damage. If you're sensitive to VOCs and prefer a water-based product, check the label; some latex primers are formulated to block stains as well as shellac-based primers. Most primers contain white pigments, and if you're painting your walls a dark color, it pays to tint the primer -- that can make the difference between two and three topcoats. Ask the sales clerk to do this for you when you buy the primer.