How does an inductor store magnetic energy? I am trying to figure out what the potential energy of an inductor with a current really means. In a capacitor, the energy stored works like this: if you let the plates attract each other, before colliding the plates would have total kinetic energy equal to that potential we gave it before. We can derive the equation $\frac {1}{2} C V^2$ by expressing $dW$ in terms of $V$ and $dQ$, then doing some integrating. This makes sense because the electric field is conservative and so we can integrate it to find a voltage. 
However, I don't really understand the energy of inductors. The magnetic field doesn't even have a potential associated with it! 
Of course there are some other questions on this topic, and so I think I should give some explanations as to why these didn't answer my question: 
This answer : I understand how an inductor can produce a voltage by a changing magnetic field which produces an electric field, but what about an Battery-RL circuit going on for a long time? The voltage across the inductor pretty much depletes to zero exponentially, but there is still a current, therefore a magnetic field, therefore magnetic energy! 
This question dodges the question completely and the link doesn't work for me. 
I know this is a really old question that you guys are probably sick of seeing but it would be very helpful for me to understand where this energy arises from. 
 A: How does an inductor store [electro]magnetic energy?
Rather surprisingly, it's something like a flywheel. You can see a mention of that here in Daniel Reynolds' electronics course:
. 
It really is like this, check out the pictures of inductors on Wikipedia, and you'll notice they're rather like a solenoid. And there's the flywheel again: "As a result, inductors always oppose a change in current, in the same way that a flywheel oppose a change in rotational velocity". Why is an inductor like a solenoid? Because a solenoid is like a bar magnet, and a bar magnet is a magnet because all the electron spins are aligned. 
Don't think of those spins as something abstract, there's some real angular momentum in there, as evidenced by the Einstein-de Haas effect. This "demonstrates that spin angular momentum is indeed of the same nature as the angular momentum of rotating bodies as conceived in classical mechanics". The point to appreciate is that electrons move in a rotational fashion, so what you've got is in essence a whole load of subatomic flywheels. And as you know, flywheels aren't always easy to stop. Hence people have been killed when they've opened the switch on a "highly inductive circuit", see this question. And in turn, that happens because of the "screw" nature of electromagnetism, wherein Maxwell said "a motion of translation along an axis cannot produce a rotation about that axis unless it meets with some special mechanism, like that of a screw". The current is the motion of translation, the flywheel is the rotation, and you can't stop it by just opening the switch. That flywheel is going to keep on going, and so is the current.    
A: The energy is stored in the magnetic field. I usually think of it as "magnetic field lines repel" but that is not very precise (useful for intuition though).
But along the same lines as your capacitor example (moving the plates to infinity takes work), if you look at a simple current loop there is a force on the wires from the magnetic field generated. This force is repulsive: the loop would like to get bigger. If you could slowly "grow" the loop, you could do work in this way. And the amount of work done is once again equal to the energy stored. Just like for capacitors.
I deliberately stayed away from equations - hoping this verbal picture helps your understanding.
A: If you disconnect the inductor from the battery, the energy will be released as the inductor generates its own electromotive force. Think of an automotive spark plug.
A magnetic field surrounds regions of current flux, e.g. a wire coil. The field will tend to preserve itself by generating voltage in a region with preexisting current but increasing resistance. However, pushing a current through a resistance takes power, $I^2R$, which will deplete the field.

The voltage across the inductor pretty much depletes to zero exponentially, but there is still a current, therefore a magnetic field, therefore magnetic energy! 

The magnetic energy in an inductor is equal to the potential energy lost by the electrons that went through it before the resistance went to zero.
A: The energy in an inductor is stored in the magnetic field which is generated by the current passing through the inductor.
In terms of how the energy gets there you need to think of the inductor having no current passing through it at the start and then applying a voltage source across the inductor.
This will result in the current through the inductor increasing which will produce a back emf, $\mathcal E_{\rm back}= L \frac {dI}{dt}$, (Faraday) which opposes the current changing (Lenz).
So to increase the current the voltage source has to do work against the back emf and that work manifests itself as energy stored in the magnetic field.  
The energy stored in the inductor is $\frac 12 LI^2$ which is to be compared with the energy stored in a capacitor $\frac 12 CV^2$ where work is done by a voltage source adding charge to the plates of the capacitor, in this case bringing like charges closer together.
The energy stored per unit volume in a magnetic field $B$ is $\frac {B^2}{2\mu_0}$ and to show equivalence of the two energy equation consider an "ideal" inductor in the shape of a solenoid,  of $N$ turns of length $l$ and cross sectional area $A$ which has an inductance $L = \frac {\mu_0N^2A}{l}$.
The magnetic field due to a current $I$ passing through such an inductor in the shape of a solenoid is $B= \frac {\mu_0NI}{l}$ 
So the energy stored is $\frac 12 L I^2 =\dfrac 12 \, \dfrac {\mu_0N^2A}{l}\,I^2 = \dfrac{\left (\frac {\mu_0NI}{l} \right)^2}{2 \mu_0}\, Al = \dfrac {B^2}{2\mu_0} \, Al.$
A: Just because magnetic fields don't do work on charges doesn't mean they don't do work at all. It does do work on a magnetic dipole. 
Using a magnetic dipole, we can define a magnetic potential energy from the equation of force on a 'test' magnetic dipole (similar to the test charge we took in electrostatics) due to magnetic field of the inductor, and a difference in magnetic potential energy between the ends of the inductor so taken is the energy supplied by the battery. $$ \Delta U = - \int_{x=0}^{x=l} \vec F_B . d \vec x $$
I hope you are being able to draw an analogy with the capacitor case where the plates are responsible for creation of potential difference and the energy is stored in the electric field instead of a magnetic field. 
