How does an inductor store energy?
This is a deeper question than it sounds. Even physicists disagree over the exact meaning of storing energy in a field, or even whether that's a good description of what happens. It doesn't help that magnetic fields are a relativistic effect, and thus inherently weird.
I'm not a solid state physicist, but I'll try to answer your question about electrons. Let's look at this circuit:
simulate this circuit – Schematic created using CircuitLab
To start with, there's no voltage across or current through the inductor. When the switch closes, current begins to flow. As the current flows, it creates a magnetic field. That takes energy, which comes from the electrons. There are two ways to look at this:
Circuit theory: In an inductor, a changing current creates a voltage across the inductor \$(V = L\frac{di}{dt})\$. Voltage times current is power. Thus, changing an inductor current takes energy.
Physics: A changing magnetic field creates an electric field. This electric field pushes back on the electrons, absorbing energy in the process. Thus, accelerating electrons takes energy, over and above what you'd expect from the electron's inertial mass alone.
Eventually, the current reaches 1 amp and stays there due to the resistor. With a constant current, there's no voltage across the inductor \$(V = L\frac{di}{dt} = 0)\$. With a constant magnetic field, there's no induced electric field.
Now, what if we reduce the voltage source to 0 volts? The electrons lose energy in the resistor and begin to slow down. As they do so, the magnetic field begins to collapse. This again creates an electric field in the inductor, but this time it pushes on the electrons to keep them going, giving them energy. The current finally stops once the magnetic field is gone.
What if we try opening the switch while current is flowing? The electrons all try to stop instantaneously. This causes the magnetic field to collapse all at once, which creates a massive electric field. This field is often big enough to push the electrons out of the metal and across the air gap in the switch, creating a spark. (The energy is finite but the power is very high.)
The back-EMF is the voltage created by the induced electric field when the magnetic field changes.
You might be wondering why this stuff doesn't happen in a resistor or a wire. The answer is that is does -- any current flow is going to produce a magnetic field. However, the inductance of these components is small -- a common estimate is 20 nH/inch for traces on a PCB, for example. This doesn't become a huge issue until you get into the megahertz range, at which point you start having to use special design techniques to minimize inductance.
This is my way of visualizing the concept of inductor and capacitor. The way is to visualize potential energy and kinetic energy, and understanding the interaction between these two forms of energy.
- Capacitor is analogous to a spring, and
- Inductor is analogous to a water wheel.
Now see the comparisons. Spring energy is \$\frac{1}{2}kx^2\$, whereas capacitor energy is \$\frac{1}{2}CV^2\$. So, capacitance, \$C\$ is analogous to the spring constant, \$k\$. Capacitance voltage,\$V\$, is analogous to spring displacement, \$x\$. Electric field across the capacitance is analogous to the force generated across the spring. What happens is that the kinetic energy of electrons are stored in the capacitor as potential energy. The resultant potential energy difference is the voltage which is kind of a pressure in the form of electric field. So, the capacitor always pushes the electrons back because of its potential energy.
Next, the kinetic energy of a water wheel can be expressed as \$\frac{1}{2}I\omega^2\$, where \$I\$ is the moment of inertia and \$\omega\$ is the angular frequency. Whereas, the energy stored in an inductor is \$\frac{1}{2}Li^2\$, where \$i\$ is the current. Thus, current is analogous to velocity which it is as \$i = \frac{dq}{dt}\$.
When current flows through a wire, the moving electrons create a magnetic field around the wire. For a straight wire, the generated magnetic field will not effect the electrons in that wire or at least can be ignored in most cases. However, if we wind the wires several thousands times such that the generated magnetic field affects the wire electrons themselves, then any change in the velocity will be opposed by the force from the magnetic field. Thus, the overall force, \$F\$, electrons face is expressed by \$\mathbf{F} = q\mathbf{E} + q\mathbf{v} \times \mathbf{B}\$. The potential energy in a capacitor is stored in the form of electric field, and the kinetic energy in an inductor is stored in the form of magnetic field.
In summary, inductor acts as inertia which reacts against the change in velocity of electrons, and capacitor acts as spring which reacts against the applied force.
Using the above analogies, you can easily find why the phase relationships between voltage and current are different for inductors and capacitors. This analogy also helps to understand energy exchange mechanism between a capacitor and an inductor such as in a LC oscillator.
For further thinking, ask the following questions. How the kinetic energy in a mechanical system is stored? When we are running, where and how is the kinetic energy stored? When we are running, are we creating a field that interacts on our moving body?
One way to conceptualize it is to imagine it to be similar to inertia of the current through the inductor. A good way to illustrate it is with the idea of a hydraulic ram pump:
In a hydraulic ram pump, water flows through a large pipe, into a fast acting valve. When the valve closes, the inertia of the heavy flowing mass of water causes a sudden huge increase in water pressure at the valve. This pressure then forces water upwards through a one way valve. As the energy from the water ram dissipates, the main fast acting valve opens, and the water builds up some momentum in the main pipe, and the cycle repeats again. See the wiki page for an illustration.
This is exactly how boost converters work, only with electricity instead of water. The water flowing through the pipe is equivelant to an inductor. Just like the water in the pipe resists changes in flow, the inductor resists change in current.