ATP synthase is a complex enzyme found in the inner mitochondrial membrane and thylakoid membranes of chloroplasts that synthesizes adenosine triphosphate (ATP) from adenosine diphosphate (ADP) and inorganic phosphate (Pi). This enzyme plays a crucial role in energy production during cellular respiration and photosynthesis, connecting the processes of energy coupling and the conversion of light energy into chemical energy.