Energy is needed to concentrate the protons on one side of the membrane.

All of the energy from molecules generated in glycolysis and the Krebs cycle was then used to pump protons (hydrogen ions) from the matrix side of the membrane to the intermembrane space.

Now that a large concentration of protons has been put on one side of the membrane, that energy can now be used to create chemical energy in the form of ATP.

The large purple object is a complex collection of proteins called ATP Synthase that acts like a motor powered by protons. As the protons enter the ATP Synthase complex from the intermembrane space they cause part of the molecule to rotate, which causes another part of the molecule to change shape. If ADP and phosphate are in the part that is changing shape, then they are pushed together and a bond is formed, making ATP. Click on the links below to see an animation of this process: