Clean the walls before painting so any grease or dirt on the surface doesn't cause bumps in the paint finish. Wipe them with a clean sponge. Let the walls dry fully before painting.
Remove register covers, light switch plates and outlet covers. Apply painter's tape along baseboard trim, window trim and other items you do not want painted in the hallway. Place a dropcloth on the hallway floor to avoid paint dripping on it.
Sand rough patches on the wall. Fill in small cracks or holes with spackling compound and a putty knife. Sand the compound after it dries so you get a flat, smooth surface. Dust off the wall so the sanding remnants don't mix in with the paint.
Paint the hallway ceiling first if you plan to paint it. Use a paintbrush to paint along the edges of the ceiling. Pour the ceiling paint into a tray and cover the roller completely with the paint. Roll the coated roller on the upper grid part of the tray to distribute the paint evenly. Roll paint onto the rest of the ceiling.
Prime the walls if you are using a primer. Use a paintbrush to cut in along the edges of the walls and around trim. Use a roller to apply the primer to the rest of the walls. Move the roller in a W shape, and overlap as you go to get an even coat without harsh primer lines. Wait to paint the walls until the primer is dry to the touch.
Stir the paint to distribute the color evenly. Pour it into a clean paint tray.
Paint the edges of the hallway walls with a paintbrush. This gives you better control so you don't get the paint on the trim or ceiling.
Wet the roller lightly with water for latex paint, squeezing the roller to get rid of excess water. Move the roller around in the paint to cover it fully. Remove excess paint by rolling the paint roller on the grid of the tray.
Paint the walls using the same W pattern you used with the primer. Make sure the entire wall is covered by continuously overlapping the W shapes.
Paint the trim in the hallway if you want to refinish it using a paintbrush for more control.