Energy of a Forced Oscillator In forced oscillations (steady state) under damping, the energy that the external force gives to the system is spent against the work done by the damped forces, and thus the stored energy of the oscillator is kept constant. However, when there are no damping forces, where does this energy that the external force provide, goes to?
 A: In the no damping scenario, the work done by the external force is sometimes positive and sometimes negative (when the oscillator is moving opposite to the direction of the force), and the work ends up averaging to zero in the steady state.
We know it must be so, because otherwise the energy of the oscillator would just keep increasing forever.
Note: all that is true in the steady state. If we wait long enough the system will approach this steady state regardless of the initial conditions. There is one special case however where there is no steady state. As @nasu points out, if the frequency of the driving force precisely equals the natural frequency of the oscillator (perfect resonance), then the system will never reach a steady state, the amplitude of oscillations will just keep increasing.
A: When the system is not in perfect resonance the oscillator will sometimes gain energy and sometimes lose energy. Only at resonance are the conditions such that the oscillator will always extract energy from the driver. When you drive the oscillator for a while it reaches steady state. At that point the oscillator is saturated and can't absorb any more energy. This plot shows the steady amplitude for damping (black lines) or no damping (red line):

At resonance ($\omega=\omega_c$) and zero damping the oscillator will always gain energy so in principle if you waited long enough you could get arbitrarily high energy. The steady state amplitude is infinity. Having zero damping is of course not really realistic.
Source of graph: https://en.wikipedia.org/wiki/Resonance
Transmissability means output/input.
Edit in response to comment:
In this plot I drew the driving force $F_0\sin\omega t$ on top of the velocity $v(t)=x'(t)$ of the steady state solution. The driving force is blue and $v(t)$ is orange. Depending on whether the driving force is above/below/on resonance you get a different phase offset.

When the driving force is too slow ($\omega<\omega_0$) or too fast ($\omega>\omega_0$) the velocity is almost 90$^\circ$ out of phase. This means about half the time the driving force adds energy (when the driving force and velocity have the same sign) and about half the time the driving force removes energy (they have the opposite sign). As $\omega$ goes near $\omega_0$ they become in phase and the driving always adds energy. Of course the damping always removes energy from the system.
