Turn off the circuit for the fan at your home's main electrical box.
Take the cover plate off the wall.
Check the circuit to make sure it's off by touching the probes of a voltage tester to the terminal screws on the sides of the switch. If you get a reading, the circuit is still live, and you need to shut it off at the main box. If you get shocked from a 240-volt line, it will kill you.
Unscrew the mounting screws that hold the switch in place, and pull it out of the electrical box inside the wall.
Loosen the terminal screws around the sides of the switch, and unhook the wires from the switch.
Untwist the plastic connector cap that attaches the ground wire. Keep the wires apart from each other so they don't come into contact. Taping them to the wall temporarily is one option.