Just think about how you might push a child's swing. You apply a push once every oscillation of the swing and thus build up the amplitude of the swing. This is a resonance condition whereas if you pushes the swing at a slightly lower frequency you would not be able to increase the amplitude of the swing as much.
Once the swing is at a constant amplitude which is achieved by you giving the swing a little push every oscillation the energy that you input into the swing during one oscillation is equal to the energy which is lost due to frictional forces during that cycle.
In general resonance is a particular example of what is called forced oscillations.
Forced oscillations are all about a system called the driveR making another system called the driveN oscillate.
Ignoring the initial behaviour (which includes the transients) the driveN system reaches steady state.
This means that it oscillates with constant amplitude at the frequency of the driveN system.
This is the driveN system undergoing forced oscillations.
If one keeps the amplitude of the driveR constant but varies its frequency one finds that the steady state amplitude of the driveN system depends on the frequency of the driver.
Resonance is said to occur when for a particular driveR frequency the amplitude of the driveN system is a maximum and that frequency is called the resonant frequency of the driveN system.
This resonant frequency is related to the natural frequency is related to the frequency of free (natural) oscillations of the driveN system.
However for amplitude resonance one must be care about this natural frequency.
Confusion often arises because there are two ways of defining the frequency of free oscillation of a system.
One is the natural frequency if there is no damping which is often called $\omega_o$ and the other is the natural frequency if there is damping and this is often called $\omega_d$.
For small damping these two frequencies are approximately the same and so often the distinction between the two is ignored.
However amplitude resonance occurs when the frequency of the driveR is equal to the natural frequency of the driveN system which if there is damping is $\omega_d$.
There are other types of resonance.
One is velocity resonance – the speed of the driveN system is a maximum and this occurs at the natural frequency of the undamped driven system whether or not there is damping.
This is also true of energy resonance which is characterised by maximum power (energy/time) being transferred from the driveR to the driveN.
In mechanical systems it is usual to talk about amplitude resonance because it is so much easier to measure a distance than a speed.
However it is current (velocity) resonance which is often referred to in electrical circuits.