Why does a coil retain a magnetic field after unplugging the power? I remember that if you connect a coil with AC and then turn off the current, the coil will retain a magnetic field for a (short?) period of time.
How or why does it retain the field after unplugging?
 A: Physically, this happens because a changing current generates a voltage which tries to push the charges in the direction they're already moving.
When you shut off the power supply, the current in the coil tries to keep itself moving, but it can't do it forever because of the nonzero resistance in the power supply and wires.
The phenomenon of currents trying to keep moving is called Lenz's law and is a result of Faraday's law which is one of Maxwell's equations.
To see what happens mathematically first, note that coils of wire have inductance.
Actually, all wires have inductance, but when you wrap a wire into a coil it gets a lot more inductance than, say, a straight wire.
Also, power supplies always have some output resistance.
Therefore, at the moment you turn off the supply, you have a series inductor $L$ and resistor $R$ circuit with some current $I$ flowing in it.
The equation for the voltage and current in an inductor is
$$V_L = L \dot{I}_L$$
and the equation for a resistor is
$$V_R = I_R R \, . $$
Since the resistor and inductor form a series circuit, the voltage drops across them must sum to zero, and the currents through them must be equal:
$$V_R = - V_L \quad \text{and} \quad I_R = I_L \equiv I \, . $$
Plugging the resistor and inductor equations into the voltage equation gives
$$I_R R = -L \dot{I}_L $$
and then using the current equation we get
$$\dot{I} = -\frac{R}{L}I \, .$$
Using the initial condition that the current before we turn off the source is $I(0)$, the solution is
$$I(t) = I(0) e^{-t/\tau}$$
where $\tau \equiv L/R$.
So you see, a circuit with large $L$ an small $R$ takes a long time to go to zero current.
