Loosen Old Terminal Screws
Loosen one of the old terminal screws, remove wire, and attach wire to corresponding terminal screw on new switch. Repeat with remaining wires. Take care to connect wires so all bare wire is safely under screw heads; clip off any excess uninsulated wire. Procedure is the same whether you're working with simple ON/OFF switch or three-way switch, but you must be more careful with the latter. Verify wiring by comparing it with manufacturer's diagram on packaging of new switch.