The ATP synthase is a nanomachine found in the inner mitochondrial membranes, chloroplasts, and bacterial cell membranes. It uses the energy from proton gradients across the membranes to produce ATP through rotary catalysis. The ATP synthase comprises two main parts - the F0 membrane-spanning portion that facilitates proton transport, and the F1 portion that extends into the matrix or cytoplasm and houses the catalytic sites to synthesize ATP. It can rotate at 8000 revolutions per minute to generate 3 ATP molecules per turn, and each ATP synthase can produce around 400 ATP molecules per second. The ATP synthase is an ancient enzyme that all cells rely on to generate energy through oxidative phosphorylation or photosynthesis.