Fill any holes or imperfections with Spackle, wait for it to dry, and then lightly sand the patches. If you have a crack, you must first widen it slightly before spackling or the spackle will just sit on top.
Scrape away any peeling, cracked paint, then sand the area smooth.
Clean the walls if they may be dirty (especially in a kitchen or bathroom), and always take a damp cloth to clean the dust off of trim and the tops of doorways.
Use paintable caulk to fill any gaps between the walls and trim before painting the trim. Fill any dings and divots in the wood with wood putty, wait for it to dry, then sand smooth.
When in doubt, prime. Using a primer can hide dark colors, block stains, and help your new paint job last longer. It’s also a must when painting exposed woodwork, and there are many primers that adhere to glossy surfaces (allowing you to skip sanding first).
Stir your paint before you begin, and don’t paint straight from the can. Obviously you would pour the paint into a roller tray if you were about to use a roller, but consider using a small bowl when painting with a brush. Its easier to hold, and decanting paint will keep the can free of the impurities (dust, wood particles, etc.) that your brush may pick up as you work.
If you want to use tape, buy painter’s tape (it’s usually blue or green, and marked as such). Apply it in short, overlapping strips, and press down firmly along the edge to ensure a crisp line.