Light like any other electromagnetic radiation, results from either an accelerating electric charge or a nuclear fusion or fission reaction. In nuclear reactions, a photon is created in the same manner as other exception of sunlight products of the reaction. With the exception of sunlight and starlight, however, light usually is the result of changes in the electronic structure of atoms and molecule as they absorb and readmit energy.
The incandescent electric light has as its light source the heat that result from the ohmic resistance of the filament to the electric current. A red-hot poker absorbs heat directly from the fire resulting from liberation of chemical energy. As the material in the filament of poker heats up, the atoms and molecules gain kinetic energy, which is realize by an increase in the number of collision among the particles. The boiling off of some of the material is one mechanism that can be used to maintain an equilibrium temperature. Another mechanism is for the electrons associated with the various atoms in the metal to move to higher energy levels they emit a photon, keeping the temperature of the material more or less constant despite the fact that energy is continually supplied. The excess energy is emitted as light.
Another type of source in energized plasma such as a flame or the gas in a discharge tube such as a neon bulb. Although light is produced by a mechanism similar to thermal emission, the atom is in gases phase and less random. The energy levels reached by the electron depend more on the electronic structure of the atoms themselves and therefore the photons emitted tend to be clustered around specific wavelengths. The spectrum produce by such a source is not at all continuous but consist of lines or bands that are characteristic of the atoms or molecules in the gas. Highly monochromatic light can be obtained from this type of source, particularly if the light is filtered. The light has a much longer coherence length but is generally unpolarized.
A third type of source is the Laser. Two principle are involve in laser operation. First, the lasing material is composed of atoms, or mixtures of atoms, that have a peculiar energy level structure. As they absorb energy, their electrons move up to higher energy levels, tending to accumulate at certain metastable levels. This is called population inversion.