Why sparking in electrical switches?

If you get sparking in an electrical switch there is a loose connection or short in the circuit. The switch should be repaired or replaced.