You have to start with a perfectly smooth surface to end up with perfectly painted walls or woodwork. Sanding levels outs spackle or joint-compound patches and flattens ridges around nail holes. Sanding also removes rough spots in your trim. Sand the walls from the baseboard to the ceiling with fine grit sanding paper. Then sand horizontally along the baseboard and ceiling. Sand woodwork with a sanding sponge to get into crevices.