Protecting surfaces is accomplished by masking them off.
Paint can get on a surface any number of ways -- intentionally or accidentally, from spatters, spills, and drips. When all the cleaning, sanding, and repair work is done, your last preparation step is to make sure to protect any surface you don't want painted.
Protecting surfaces is generally accomplished by masking them off. It takes a bit of time, but it's a lot easier and takes a lot less time than trying to remove paint from a place it doesn't belong -- and from which it may not come off. So don't rush this process.
Painting a room starts with the ceiling, but if you are not painting the walls, you should drape them as shown here. If you are painting the walls, you generally won't have to protect them, even if the wall color will be different than the color of the ceiling. The wall may receive some spatters (minimized by the use of a quality ceiling paint), but you can get at spatters with a quick swipe of a dampened cloth. When masking surfaces, use blue painter's tape. It goes on and comes off more quickly than the old-style masking tape. Remove the tape before the paint dries.
Starting at one corner, stick one end of the 2-inch painter's tape to the wall, carefully pull away about 10 feet of tape from the roll and tear it. Tack this end to the wall so it doesn't stick to itself. Press the top half of the tape into the corner where the ceiling meets the wall.
Unfold a sheet of clear plastic so you can work with it, and starting at either corner, slip the top edge of the plastic under the loose flap of the tape. Press the tape to the plastic and continue along the wall, letting the sheet drape down to protect the surface.
If baseboards are stained and varnished, will be painted a different color, or won't be removed for replacement, you should mask them to keep ceiling- and wall-paint spatters off them. For this job, use masking film or masking paper applied with a dispenser. Start at one end of the baseboard and press the tape firmly on the top edge for about a foot. Gradually pull the dispenser away from the corner, exposing more film and tacking it as you go. Let the film drape down over the baseboard or tape its edge to the floor.