Always begin any electrical procedure by shutting the breaker off and testing the project with a multi-tester to confirm that no power is present. On a modern basic light switch there are three wires. One wire is the line wire that comes from the breaker box. Another wire is the load wire that goes to the light fixture or possibly an outlet that is to be controlled by the switch. The third is simply a ground wire that is connected to the side of the switch with a green screw.
The most common reason for replacement of a switch is that it fails to make sufficient contact internally to turn on the lights. Another reason would be an impact to the switch resulting in a break to the toggle or surrounding area. To replace the switch, turn off the breaker and remove the switch plate. Remove the retaining screws and pull the switch forward and remove the wires. Reverse the procedure with your new switch and turn on the power.
An outlet that needs to be replaced is usually a result of an impact. Outlets in open, high traffic areas often suffer regular abuse, particularly in public places where sweepers or buffers are being used. Outlets that provide power to high amperage appliances such as microwaves will occasionally need to be replaced as the internal contacts become less reliable due to overheating.
Basic outlets generally have five wires unless the outlet in question happens to be the last one on the circuit. Aside from the green ground, there will be a black and white wire feeding the top or bottom of the outlet and another white and black leaving the outlet providing power to the next outlet in the circuit.
When you replace an outlet, check to see if the outlet is fifteen or twenty amps and replace it with the same. If you aren’t sure just take it to the hardware store and get some help choosing your new outlet. Replacing an outlet is just like replacing a switch. Turn the breaker off and verify the power is off with a multi-meter. Remove the cover plate and the retaining screws and pull the outlet from the box and then the wires from the outlet. Reverse the procedure to reinstall your new outlet.
I hope this has given you some insight regarding switches and outlets. Remember that in any home repair project that safety is the most important aspect. Consult a professional if you ever have doubts about your ability to complete a task.