What is the reason behind resonance? At the technical highschool that I attend, the instructor said that the cause of resonance is that energies increase differently.
Kinetic energy increases quadratically and potential linearly, so the ampitude of the oscillation compensates for that.
The instructor is also a technician, so he honestly admitted he just memorized that phrase.
What is the meaning of this? In which way amplitude compensates?
Is this the reason behind resonance?
 A: So resonance requires three things:


*

*An oscillator—a system which has some inertia and some restoring force, usually able to contain energy with some sort of characteristic frequency of stable oscillations.

*A driving force—an oscillation at a fixed frequency that is adding energy into the system.

*Dissipation—a drag force like friction that is removing energy from the system.


Given these three features, the amount of energy that ends up in the system can be wildly different depending on the comparison between some derived frequency, and the driving force. This happens because the oscillations superimpose.
An example - a slinky
A really great example, if you can find one, is a Slinky. You can hold one end from your hand and let the other end hang free into open space. It is an oscillator, friction with the air and heating due to internal deformation and eventually self-collision provides the dissipation. You can drive it by moving your hand up and down 1cm, to see how big of an oscillation you can create on the free-hanging edge.
You can drive it with very fast small vibrations, moving your hand up and down as fast as possible that 1cm, and you will see that the bottom of the slinky shakes noisily but mostly stays in the same place. Each pulse takes a certain time to travel down the slinky and then come back to you, you are firing many small pulses into the slinky before any of them come back.
You can on the other hand drive it with vibrations that are as slow as possible, moving your hand up and down the 1cm over the course of many seconds or even a minute. You will notice that the bottom edge of the slinky mostly just follows the top motion of your hand. The pulse is so big that it consumes the entire slinky at once.
But somewhere in the middle between these two, the pulse that you have “put out” is in some sense “coming back” at just the right time so that your next pulse adds directly on to that next one. When you find this frequency, this little motion of only 1cm starts to build up with each motion: at first it is 1cm, then it is 2cm, then it is 3cm, until soon the slinky is moving up by 50cm or more, crashing into itself as it comes higher. And that is what resonance looks like: a tiny driving force stores a tremendous energy in the system.
Another example: a swingset
Have you ever swung on a swingset? This is actually the exact same thing!
If you just stop swinging on a swingset, you will oscillate back and forth and air drag and the friction of the chains will eventually bring you to a halt. Most people intentionally stop before this by increasing their dissipation—they put their feet on the ground.
But what people almost never try is to use the swing off-resonance. Go ahead and try it some time, try to go back-and-forth faster than you normally would. You should find that the reason you never do this is that you never get anywhere. Same if you go too slow, the swing does not recognize it. But as you get closer to the right frequency of shifting backwards and forwards, you start to push the swing forwards while it is going forwards, and pushing it backwards while it is going backwards. And that is huge.
The reason that it is huge comes down to something called the work-energy theorem. This says that the power—kinetic energy per unit time—added to a system depends on a vector “dot product” between the force and the velocity, $$P = F~v~\cos\theta$$ where $\theta$ is the angle between the force and the velocity. If you push in the same direction as velocity, then $\cos\theta = 1$ and you add kinetic energy to the system. If you push against velocity, then $\cos\theta = -1$ and you remove it.
So the energy in the swingset at different human-movement-frequencies depends on two things:


*

*Dissipation means energy is leaving the system; usually the more energy there is in the system, the more is the flow out of it.

*Driving means that the human is putting energy into or out of the system; it only enters the system if the force can be reinforcing the oscillations in the swing. If you are close to the resonance frequency then you will be pushing it forward while it goes forward, and pulling it back when it comes back, so you will add energy both directions.


Because dissipation increases as you hold more energy, these come to a certain balance point called an equilibrium. These situations are very common in physics; another example would be if there is a clog in a drain, then if you run the faucet at a constant slow rate, the sink will fill up until the pressure at the bottom pushes as much water out of the clog as is flowing in from the top. Actually many high-profile physicists seem to have the same story, that their first bewilderment in physics involved water going downhill, where they childishly thought they could just stop it by placing an object in its way, only to be very surprised when the water started accumulating behind that obstacle until it could flow over or around it and continue on its merry way downstream. Equilibrium!
In a simple differential equation seen with complex numbers
Now if you are in a great technical high school, you might know a bit more technical things like derivatives and complex numbers. Let me guess that maybe you are and give you a slightly more mathematical view of these sorts of systems.
The absolute easiest place to see these balances in a real equation is in a differential equation that contains the basics of linear drag, harmonic response, and forcing, $$\ddot x(t) + 2 \lambda \dot x(t) + \Omega^2 x(t) = e^{is t}.$$ The first term is if you like an acceleration for a unit mass; it is a second time derivative of some function $x(t)$. The third term complements it with a restoring force, and if those two terms were all, the system would oscillate like $\cos(\Omega t)$ or so. The term between them adds the drag force, at the level that bacteria and other small things experience, an $|F| \propto |v|$ drag—us big creatures in air actually typically see an $|F| \propto |v|^2$ drag, but this one is easier to solve. 
Finally we have the forcing term, which I am writing as the complex oscillation $e^{ist}$ for variable $s$. There is nothing in theory wrong with using real numbers and $\cos(st)$ if you are not comfortable with these yet, but one does have to then do a lot of work with sines and cosines to get the same basic answers and as one becomes more and more of a physicist one gets more and more lazy.
Given this equation, it is clear that a particular solution $x(t) = A e^{is t}$ will work, but only if $A$ is a very particular complex number: $$
A (-s^2) e^{ist} + 2 i \lambda s e^{ist} + \Omega^2 e^{ist} = e^{ist}\\
A = \frac{1}{-s^2 + 2 i \lambda s + \Omega^2}.$$(This is only one solution out of many, but the general solution just adds some terms that exponentially decay to zero due to this loss term $\lambda$ so that this $A e^{is t}$ term is the only long-lived term. Search for “overdamping” to see the details of these decays worked out.)
The squared magnitude of the resulting wave usually has something to do with the energy stored in the resonator and it depends on the frequency of the resonator as $$|A|^2 = \frac1{(\Omega^2 - s^2)^2 + 4 \lambda^2 s^2}$$This attains its maximum at a very particular frequency, $s^2 = \Omega^2 - 2 \lambda^2$ or so. In other words it's not quite the resonant frequency of the oscillator $\Omega$ but it is close by, shifted by the loss parameter $\lambda^2/\Omega$ or so away. 
A: It's very important to learn about the phase variation of the response through the resonance - I feel that is not usually appreciated when encountering harmonic oscillators for the first time. 
Here is the equation of motion for the displacement of a driven harmonic oscillator:
$ m\ddot{x} + 2\gamma \dot{x} + kx = F(t)$
where the three terms on the left-hand side represent inertia term, damping term, and potential term respectively and the right-hand side represents the driving term. And let's assume the drive is of single frequency: $F(t) = F e^{-i\omega t}$. At steady state, the system will also oscillate at the same frequency, but possibly with some phase shift, so that $x(t) = X e^{-i\omega t}$ ($X$ is a complex number$). Then we have
$ (-m\omega^2 -2i\gamma \omega + k)X = F$
or 
$ X = F/(\omega_0^2 - \omega^2 - 2i\gamma\omega)$
where $\omega_0 = \sqrt{k/m}$ is the resonance frequency. 
When the oscillator is driven, the potential term (if the oscillator is made of a mass attached to the spring, that is the spring energy) is in-phase with the driving. The inertia term (related to kinetic energy) is 180-degree out-of-phase with the driving. When the driving frequency is way below the resonance frequency, the oscillator oscillates at the driving frequency in-phase (potential term dominates over the inertia term). When the driving frequency is way above the resonance frequency, the oscillator oscillates out-of-phase (picture yourself shaking a pendulum too hard). At resonance, the in-phase and the out-of-phase terms cancel. With a small damping term (which all real oscillators have), the system oscillates 90-degree out-of-phase with respect to the driving term in steady state. 
A: In my opinion, your instructor has no in-depth understanding of resonance, as he mentioned in his statement about merely memorizing a statement from the author that he was using.  Kinetic energy increases quadratically and potential energy increases linearly, but both energy forms increase monotonically, meaning that there is nothing cyclic about them.
For resonance to occur, you need to interact with a cyclic process, which is usually modeled with a sine function.  In your interaction with the cyclic process, your addition of energy to the process needs to be in phase with that process, such that each time you interact with it, you increase the amplitude of the sine wave that describes it.
For a concrete example of this, consider a child that is on the playground, and is sitting in a swing (a form of pendulum).  He (or she) wishes to go higher in the swing and asks you to push him.  As the swing starts oscillating about its equilibrium point (the point closest to the ground), you have to decide when to push.  If you push at the equilibrium point as the swing is approaching you, you will subtract energy from the swing, and the child will experience a smaller amplitude in the swing.  If you push at the equilibrium point as the child is going away from you, you will add somewhat to the amplitude of the swing, but this is not the optimum point to push.  If you push just as the child is at the highest point and starting to drop back down, you will be in phase with the swing, and you will be adding the maximum amount of your push to the amplitude of the swing at that point.  As a result, the child will quickly go higher and higher because your interaction with the swing is in phase with it, and as a result, you are seeing an example of resonance.
All mechanical devices have frequencies that they like to vibrate at.  If you add cyclic energy to these systems at that frequency, they will vibrate in phase with that frequency at ever higher amplitudes until they come apart, as demonstrated by the video referred to by StudyStudy (The Tacoma Narrows Bridge collapse: see https://www.youtube.com/watch?v=j-zczJXSxnw).
A: Actually, that's a pretty good description of the onset of resonance if you're viewing resonance on an oscilloscope - noting that at resonance there's a large narrow peak.
At resonance, the forced oscillation is pumping energy into the natural oscillation of the object resulting in larger and larger amplitude oscillations assuming there's sufficient power.
In certain cases, it is possible for resonances to blow up objects. For instance, Google for the Tacoma Narrows Bridge for a dramatic example.
But your TV, radio, cell phone, WiFi, bluetooth devices, etc., will only work properly when the device is tuned to a low power resonance.
A: The reason for resonance is that the transfer of power to your oscillating system is maximised when the driving force and velocity are in phase. 
The power transferred is the product of driving force and velocity; both are sinusoidally varying terms with an arbitrary phase difference between them.
If you multiply two sinusoidal terms together (the force and the velocity) with a phase difference between them, then the product has its maximum average value when that phase difference is zero and a minimum value when the phase difference is $\pm \pi/2$.
Resonance occurs when you make the phase difference zero.
Mathematically, with a driving force $F_0 \sin \omega t$, then the displacement $x \propto \sin(\omega t + \phi)$, where the phase difference $\phi$ is given by
$$ \phi = \tan^{-1}\left(\dfrac{-\gamma \omega}{\omega_0^{2} - \omega^{2}}\right),$$
where $\gamma$ is the damping coefficient and $\omega_0$ is the natural frequency of the oscillator.
You can see that when $\omega = \omega_0$ the phase difference between displacement and force is $-\pi/2$. But if you differentiate the displacement to get the velocity $$v \propto \cos(\omega t + \phi) = \sin(\omega t + \phi +\pi/2)$$ 
and thus when $\omega =\omega_0$ the phase difference between velocity and force is zero.
If the power transfer is maximised, then this is also why the amplitude becomes large, since the velocity amplitude also increases with the amplitude of the displacement. 
