Moving electrons to pump protons
The electron transport chain is a series of complexes in the inner mitochondrial membrane. NADH donates electrons at Complex I and FADH2 at Complex II. Electrons pass through ubiquinone (coenzyme Q), Complex III, cytochrome c, and Complex IV, where they finally reduce molecular oxygen to water. As electrons move, Complexes I, III, and IV pump protons into the intermembrane space.
This builds an electrochemical proton gradient. Protons flow back through ATP synthase (Complex V), and that flow drives the phosphorylation of ADP to ATP, a process called oxidative phosphorylation.
Why the ATP yield is given as a range
Older texts cited 36 to 38 ATP per glucose, but accounting for the cost of shuttling NADH into mitochondria and proton leak, modern estimates place the total nearer 28 to 30 ATP. The figure is an approximation rather than a fixed number because proton-to-ATP ratios are not whole integers and some gradient energy is used for transport and lost as heat.