For any voltage v(t) the following equation is true:
It shows a 90 degrees pahse shift if v(t) is sinusiodal: the integral of a sine is a (-)cosine.
It also shows that, if we apply a constant voltage V across an inductor, the current flow in it will increase linearly:
v(t) = v(0) + V∙t/L.
If we remove this voltage, the current flow will continue, provided of course there's a path. If there is no path for the current, a large voltage peak will appear across the inductor. Hence the diode across a transitor-controlled relay:
A relay consists of an electromagnet and a switch that closes when a current flows in the electromagnet. This current is generally controlled by a transistor. When the transistor turns off, there is no path for the coil current. The voltage peak across the relay may destroy the transistor. The diode will prevent this. After turning off the relay, the coil current will flow in the diode.