How a Laser Works
Background: Stimulated Emission
The principle that drives a laser is called stimulated emission. When an electron moves from a higher energy level to a lower one, a photon is emitted whose frequency depends on the energy lost. This may happen at random intervals, called spontaneous emission, or it may be caused. Stimulated emission is the immediate this energy level drop caused by an incoming photon with energy equal to the drop.
Interestingly, the released photon has the same frequency, direction, phase as the incoming photon. This means it amplifies light. That is an essential part of lasers, because they create a beam of light in the same direction.
The goal of a laser is to create stimulated emission, but where do you get the electrons from? The electrons come from the gain medium. Recall that the purpose of stimulated emission is to amplify the light to create a laser. Gain is the amplification, meaning the transfer of energy into emitted electromagnetic radiation. Gain media can be many things: gases (gas lasers), crystals (solid-state lasers), semiconductors (semiconductor lasers).
The only major difference between types of lasers is the gain medium. They all have the same purpose.
It is important to recall that lasers work through stimulated emission, where excited electrons emit photons. In order to get those electrons into an excited state, energy has to be pumped in, hence a pump source.
Now, there is an important bit of terminology to note. Normally, most electrons exist in the ground state. An interaction with the electrons and light would be dominated by absorption rather than stimulated emission. That is to say, most electrons would be raised to a higher energy level, absorbing the energy of the photon. We don't want this. We want stimulated emission. So, we want to create a population inversion. This is when the number of excited electrons is greater than the number of electrons at the ground state. Only when population inversion is achieved can light be emitted more than absorbed, creating a laser.
Essentially, light/electrons excites the electrons in the laser, then that same light causes lasers. The light starts in the correct direction, because stimulated emission amplifies it. This is called end pumping, there are other forms of pumping, which introduce light in other directions (e.g. side pumping).
Reflective Cavity/Output Coupler
Note that when we sent the light through the gain medium, it amplified the beam through stimulated emission. Sometimes, this is enough amplification to sufficiently create a laser (Nitrogen lasers, for example). However, in many cases, a single pass of electromagnetic radiation through a gain medium isn't strong enough. It has to go through multiple times. This is possible if we use two mirrors, also called an optical cavity. However, light has to escape eventually! So, the front mirror is slightly transparent, while the back mirror is normal. Each reflection, a little light is emitted, while most comes back and is amplified. This is able to create a continuous, high-powered beam.