Any damage from moisture needs to be repaired. For wood handrails, this means removing any rotten wood and repairing with a wooden patch -- a "Dutchman" -- or two-part epoxy wood filler. Wood handrails beyond repair need to be replaced. Iron and steel handrails are often rusty. Scraping heavy rust with a wire brush, and slight rust with emery cloth or coarse steel wool, is usually adequate.
After rust and rot have been eliminated, prepare the surface to receive a new coat of paint. Scrape loose paint from surfaces with a small scraper or wire brush. Sand old paint on wood or metal with 100-grit sandpaper. Scrub the railing clean with an all-purpose cleaner, rinse with clean water and allow it to dry.
Prime bare wood and metal with an oil-based exterior primer. If working with metal, metal primer in spray cans is very convenient. If you are painting over wood and you're not sure whether the existing paint is oil or latex, oil-prime the entire surface.
Use an oil-based top coat for metal handrails. Once again, you can use a spray paint formulated for exterior metal surfaces. Wooden handrails can be painted with the best acrylic exterior latex paint you can afford. Acrylic is the strongest paint binder, so choose a paint with a high amount of acrylic.
Check the handrail annually for water damage. Scrape rust as you find it, then spot prime and paint. Pay particular attention to wooden handrails, because they are particularly vulnerable to water damage. Blistering and peeling paint should be removed right away and spot-primed and painted. If a wooden surface won't hold paint for more than a season, considering sealing bare wood with paintable exterior wood preservative before priming.