Why outlets spark when unplugging - EMF & Inductors

The comparison of inductors with water hammer is an excellent hydraulic analogy.

Here is the details missing from the explanation:
There is a ferromagnetic piece of metal in the center of the coil of wire. The act like a reservoir of magnetic energy. When we apply current, there magnetic field grow progressively by rotating each magnetic domain, which are random initially. As more and more domain rotate, the electric energy gets stored as magnetic field. Eventually, all magnetic domain are aligned, we have reached saturation. At that point, the electric energy in the coil become a wasted as heat.
When removing the electric source, the inductor attempt to maintain the same current. It will raise the voltage as much as possible until it succeed to force the same current as before. As the electric energy flow out of the inductor (being spent as heat and light in the electric arc on the switch), each magnetic domain return to their original position.

When all magnetic domain finally return to their rest angle, the inductor stop providing electric current, so the arc in the contact of the switch stop.

In the case of high voltage transformer, like still used in any car to create the arc on the spark plug, the  natural attempt to reach the voltage is used to get about 120 volt from the 12 volt of the battery. This is the voltage that we can measure on the primary side, where the contact (or transistor) send pulse synchronized with the rotation of the cam shaft. The secondary is made of about 20 times more turns then the primary, thus raising the 120 volt to the 2400 volt needed for the spark plug.

In case of CRT TV which needed 25 kilovolt to accelerate the electron on the screen, the same "flywheel" effect is used to increase the voltage from 120 volt pulsed DC to 1200 volt short spike on the primary and then 10 kilovolt on the secondary. A voltage tripler is then used to reach 25 kv, about 5 kv being lost from the high impedance of the coupling capacitors. The first "all solid state" TV appeared in 1976 when a high voltage transistor (1500 volt) was finally successfully built.

For switching power supplies, the kick back (flywheel) effect of the inductor is rarely needed. Instead, it is the constant current which is exploited by using low impedance output to force the voltage to remain under tight control. Fast PWM pulses are used with the width of the pulse constantly adjusted using negative feedback loop to maintain a fixed voltage while responding to variable current from variable load. A typical laptop quickly alternate between 1 amp and 3 amps, sometime changing the load current many times every second. The PWM pulse width is effectively modulating the total energy entering the switching inductor in order to adjust the current as required by sudden start or sdtop of CD rom motor, video card rush current triggered by different scene in a video game, etc