If I punch a switch on the switchboard into the on or the off position, I've noticed that there's a bright orange-ish spark. That led me to believe that there was some fault in the switch itself. But when I turn that switch (or any switch for that matter) on or off gently, there's no sparking. Why?
In classical electromagnetic theory, the principle of electromagnetic induction is used to describe the phenomenon in which a change in the magnetic flux $\phi$ linking an electric circuit induces an electromotive force (emf), $\epsilon$ in that circuit.
The direction of the emf is such that a current (and resulting magnetic flux) opposes the change in magnetic flux which is inducing the emf (Len'z law) and the magnitude of the emf is proportional to the rate of change of the magnetic flux.
This is knows as Faraday's Law:
So when you have a live circuit carrying a current and you suddenly open the switch, the magnetic flux which the current produces suddenly collapses, however this does not happen instantly. According to Faraday's law, the suddenly collapsing magnetic flux will induce an emf in the circuit, the direction of which will be such as to maintain the current in the circuit to oppose the change in magnetic flux. The magnitude of this emf will be proportional to the rate of change in magnetic flux, so when you flick the switch quickly, the magnetic flux changes quickly resulting in a larger emf. This in turn creates a large electric field gradient across the contacts of the switch. If this is greater than the ionisation potential of the air, then the molecules of the air in the vicinity of the switch will partially ionise, allowing them to conduct electricity which is manifested as a 'spark' across the switch. Conversely, when you flick the switch gently (slowly), resulting potential gradient across the switch becomes smaller.
Furthermore, if the circuit is largely 'inductive' (such as an incandescent lamp, heater element, or electric motor) then it is more likely to produce a more visible spark when the circuit is opened, because the 'inductive' element(s) in the circuit are storing energy in the form of magnetic field(s), which results in higher induced emf when the field collapses.
The spark can be eliminated in DC circuits by using a reverse-biased diode across the inductive element. This has no effect when the switch is closed, since it is reverse biased, but when the switch is opened, the magnetic field in the inductive element suddenly collapses, resulting in a 'reverse' emf can now conduct through the rever-biased diode, so a current flows through this diode, back through the inductive element, allowing the magnetic flux to me maintained and slowly dissipated as heat due to electrical resistance.
In the case of switching of AC circuits (particularly for larger, inductive loads), the 'flyback diode' method can not be used, so alternative methods of arc suppression include special design of the contact surfaces to as to better control the spark as the switch is opened, thereby minimizing the level of ionization. For high-voltage, high-power switches, the contacts could be immersed in a non-ionizing gas or vacuum.