Processes that involve an increase in entropy of the system (ΔS > 0) are very often spontaneous; however, examples to the contrary are plentiful. By expanding consideration of entropy changes to include the surroundings, we may reach a significant conclusion regarding the relation between this property and spontaneity. In thermodynamic models, the system and surroundings comprise everything, that is, the universe, and so the following is true:
If an electron is in an excited state it can return to a lower energy level. When it does this, it loses energy. The amount of energy it loses will be equal to the difference in the energy levels it moves between. This energy is released as a photon.