|First, turn of the power to the switch at the breaker. Then remove the plate cover. If you have some sort of volt tester you should test the wiring to make sure there is no current there. Sometimes people run wires from another circuit through a box. Unscrew the screws that go into the electrical box. These hold the switch to the wall. The switch will be only held by the 3 wires, the two black wires (power), green or bare copper (ground). Remove the screws one at a time that hold the wires. Carefully remove the broken switch. Replace wires in reverse order to the same locations. The switch will (or should) be connected to the black wire on both screws. A switch is designed to cut the power side of the circuit not the neutral. Remember the wire is wrapped around the screw in a clockwise (the way you would tighten) direction.
**note** if there is another switch that controls the same light then you will need a ‘3 way’ switch and there will be a forth wire (red) connected to the switch.