A laser is a device that controls the way that energized atoms release photons. "Laser" is an acronym for light amplification by stimulated emission of radiation, which describes very succinctly how a laser works.
Although there are many types of lasers, all have certain essential features. In a laser, the lasing medium is “pumped” to get the atoms into an excited state. Typically, very intense flashes of light or electrical discharges pump the lasing medium and create a large collection of excited-state atoms (atoms with higher-energy electrons). It is necessary to have a large collection of atoms in the excited state for the laser to work efficiently. In general, the atoms are excited to a level that is two or three levels above the ground state. This increases the degree of population inversion. The population inversion is the number of atoms in the excited state versus the number in ground state.
Once the lasing medium is pumped, it contains a collection of atoms with some electrons sitting in excited levels. The excited electrons have energies greater than the more relaxed electrons. Just as the electron absorbed some amount of energy to reach this excited level, it can also release this energy. As the figure below illustrates, the electron can simply relax, and in turn rid itself of some energy. This emitted energy comes in the form of photons (light energy). The photon emitted has a very specific wavelength (color) that depends on the state of the electron's energy when the photon is released. Two identical atoms with electrons in identical states will release photons with identical wavelengths.