Oxygen evolution
Oxygen evolution is the process of generating molecular oxygen (O2) by a chemical reaction, usually from water. Oxygen evolution from water is effected by oxygenic photosynthesis, electrolysis of water, and thermal decomposition of various oxides.  The biological process supports aerobic life.  When relatively pure oxygen is required industrially, it is isolated by distillation of liquified air.

Oxygen evolution in nature

Photosynthetic oxygen evolution is the fundamental process by which oxygen is generated in earth's biosphere. The reaction is part of the light-dependent reactions of photosynthesis in cyanobacteria and the chloroplasts of green algae and plants. It utilizes the energy of light to split a water molecule into its protons and electrons for photosynthesis. Free oxygen, generated as a by-product of this reaction, is released into the atmosphere.

Water oxidation is catalyzed by a manganese-containing cofactor contained in photosystem II known as the oxygen-evolving complex (OEC) or water-splitting complex. Manganese is an important cofactor, and calcium and chloride are also required for the reaction to occur. The stoichiometry this reaction follows:
 2H2O ⟶ 4e− + 4H+ + O2
The protons are released into the thylakoid lumen, thus contributing to the generation of a proton gradient across the thylakoid membrane. This proton gradient is the driving force for ATP synthesis via photophosphorylation and coupling the absorption of light energy and oxidation of water to the creation of chemical energy during photosynthesis.

History of discovery
It was not until the end of the 18th century that Joseph Priestley discovered by accident the ability of plants to "restore" air that had been "injured" by the burning of a candle. He followed up on the experiment by showing that air "restored" by vegetation was "not at all inconvenient to a mouse." He was later awarded a medal for his discoveries that: "...no vegetable grows in vain... but cleanses and purifies our atmosphere." Priestley's experiments were followed up by Jan Ingenhousz, a Dutch physician, who showed that "restoration" of air only worked in the presence of light and green plant parts.

Ingenhousz suggested in 1796 that CO2 (carbon dioxide) is split during photosynthesis to release oxygen, while the carbon combined with water to form carbohydrates. While this hypothesis was attractive and reasonable and thus widely accepted for a long time, it was later proven incorrect. Graduate student C.B. Van Niel at Stanford University found that purple sulfur bacteria reduce carbon to carbohydrates, but accumulate sulfur instead of releasing oxygen. He boldly proposed that, in analogy to the sulfur bacteria's forming elemental sulfur from H2S (hydrogen sulfide), plants would form oxygen from H2O (water). In 1937, this hypothesis was corroborated by the discovery that plants are capable of producing oxygen in the absence of CO2. This discovery was made by Robin Hill, and subsequently the light-driven release of oxygen in the absence of CO2 was called the Hill reaction. Our current knowledge of the mechanism of oxygen evolution during photosynthesis was further established in experiments tracing isotopes of oxygen from water to oxygen gas.

Water electrolysis
Together with hydrogen (H2), oxygen is evolved by electrolysis of water. 

Electrons (e−) are transferred from the cathode to protons to form hydrogen gas. The half reaction, balanced with acid, is:
2 H+ + 2e−   →  H2

At the positively charged anode, an oxidation reaction occurs, generating oxygen gas and releasing electrons to the anode to complete the circuit:
2 H2O  →   O2  +  4 H+  +  4e−

Combining either half reaction pair yields the same overall decomposition of water into oxygen and hydrogen:

Overall reaction: 
2 H2O   →   2 H2  + O2

Chemical oxygen generation
Chemical oxygen generators consist of chemical compounds that release O2 upon some stimulation, usually heat. They are used in submarines and commercial aircraft, providing emergency oxygen.  Oxygen is generated by high-temperature decomposition of sodium chlorate:
2 NaClO3  →  2 NaCl  +  3 O2
Potassium permanganate also releases oxygen upon heating, but the yield is modest.
2 KMnO4  →  MnO2  +  K2MnO4  +  O2

See also 
 Great Oxygenation Event

References

External links
Plant Physiology Online, 4th edition: Topic 7.7 - Oxygen Evolution
Oxygen evolution - Lecture notes by Antony Crofts, UIUC
Evolution of the atmosphere – Lecture notes, Regents of the University of Michigan
How to make oxygen and hydrogen from water using electrolysis

Photosynthesis
Breathing gases
Oxygen
Biological evolution