Measure the length of your staircase. Stairs with more than three treads require a handrail. Handrails more than 8 feet long require three brackets so figure one bracket for every 4 feet of staircase. According to building codes, railings must be one continuous piece. Purchase a railing cut to that measurement, plus 6 inches.
Slide an electronic stud finder along the wall above your stairway to locate the studs nearest the first step, last step and every 4 feet in between. Mark each with a strip of painter's tape.
Stand on a step and determine a comfortable height for the railing; most local building codes allow a variance between 30 and 38 inches above the top of the tread. Measure the depth of the handrail and the length of the bracket, from its top to the screw hole at the bottom. Add those two measurements together and subtract that number from your desired railing height. Measuring up from the top of the tread, mark that measurement on the tape marking the studs.
Drill pilot holes on the marks and install each bracket through the bottom screw hole. Ensure each bracket is upright and install the other two screws on each.
Mark 3 inches from the end of each rail. Cut each end at a 45-degree angle using a miter saw or miter box and saw to create an outside miter -- point sticking out -- at each end. To form the corners that create the required returns back to the wall, Tom Silva, general contractor for This Old House, recommends just swapping the end you cut from the bottom end of the railing for the top and vice versa to get a perfectly mitered corner.
Apply wood glue along the miter cuts, and nail the pieces in place with 2-inch finishing nails. Putty the nail holes. Wipe off any excess glue and sand any rough edges along the cut with a sanding block.
Check the rail against the brackets and trim any excess off the ends of the returns.
Screw the railing to the bracket posts with the included U-shaped straps. Start at the bottom bracket, then move to the top before securing any center bracket.