Adenosine triphosphate is produced by the enzyme ATP synthase, which possesses highly conserved structure and genetic coding – that is, the structure and genetic code for ATP synthase is remarkably similar in all known forms of life.
ATP synthase is powered by a transmembrane electrochemical potential gradient, usually in the form of a proton gradient, which is generated by an electron transport chain. In all living organisms, a series of redox reactions are employed to produce the transmembrane electrochemical potential gradient required for phosphorylation reactions:
AMP + Pi → ADP + Pi → ATP. (Pi is inorganic phosphorus)
Redox reactions are chemical reactions in which electrons are transferred from a donor molecule to an acceptor molecule. The Gibbs free energy of the reactants compared to the products provides the chemical potential enegy for redox reactions.
The Gibbs free energy is the energy available (“free”) to do work. Any reaction that decreases the overall Gibbs free energy of a system (reactants → products) will proceed spontaneously with release of that energy. The transfer of electrons from a high-energy donor molecule to a lower-energy acceptor molecule can be spatially separated into a series of intermediate redox reactions within an electron transport chain. The spatial separation permits biological control of the reactions.
Harvard University provides a wonderful video explaining operation of the F1-F0 ATPase.