Turn off the power in your home. In addition, lock out the circuit breaker or service panel so that no one can accidentally turn the power back on. Put on safety glasses and a dust mask.
Unscrew the screws on the switch plate that controls the power to the fan with a screwdriver. Take the plate off and pull the switch out of the work box.
Find the two black wires and the ground wire and take them out of the switch. Look at their copper ends to ensure they are in working condition. If they are worn, clip them back to the black coating. Strip about ½ inch of the coating off using wire strippers or cutters to expose the good, copper wiring.
Connect the ground pigtail to the ground wire using a wire connector -- the ground pigtail is usually green and the ground wire is usually bare copper. Connect the black pigtails from the switch to the black wires in the work box using more wire connectors.
Push the wires to the back of the work box. Secure the control switch to the work box by installing screws into the holes above and below the switch that connect to the work box. Situate the faceplate over top the switch and screw it back into the wall. Turn the power back on and test the switch to ensure it works.