Clean the fence with a power washer or scrub brush and hose, unless it's new. If the fence is old, apply siding detergent containing mildewcide. Some deck and fence detergents also lighten old wood and even out old stain color; look for a product like this if your fence is old and discolored. Allow it to dry for at least a day.
Protect the ground underneath the fence with cardboard, plastic sheeting or drop cloths. Stain is very runny and messy to use.
Prime the fence with stain-blocking primer if using a solid-color stain. Check the label; not all solid stains require primer. Apply the primer with a 4- or 6-inch brush, or a roller with at least a 3/4-inch nap. Allow it to dry, then apply two coats of solid color stain in the same manner.
Apply semi-transparent stain to unprimed wood with a roller followed immediately by brushing it into the rough boards, or with a brush alone. Work in sections, brushing each section out before the stain has had time to start drying and getting sticky.
Read the product label -- some stains will benefit from a second coat for maximum durability, but others only require one coat and a second coat may cause peeling. There are many different stain formulas on the market.