The process of this is also known as oxidative phosphorylation.
Process
Initially, we start with NADH, which we made from glycolysis and the Krebs cycle. This becomes NAD+ + H+ + 2e-, so the NADH releases its electrons to become NAD+. Over time, transport proteins move electrons through different electron acceptors, such as CoQ, and CytC, eventually getting to the final state, where the electrons are accepted by the oxygen to form water. (1/2 O2 + 2e- + 2H+ -> H2O)
Impact of Cyanide
Cyanide inhibits the the last reaction, thereby stopping the flow of electrons, like a traffic jam on a highway. This stops the process of the electron transport chain, and almost completely eliminates ATP production. That's what makes cyanide so deadly: it immediately stops cellular respiration.
Movement Across Concentration Gradient
Whenever electrons move from proton acceptor to proton acceptor, they release a little bit of energy. FADH2 joins later in the transport chain than NADH, so it creates less energy. That energy is used to move H+ from the very inside of the mitochondria (the Matrix) to the intermembrane space. Because of this, a lot of H+ ions (or protons) end up existing in the intermembrane space. Like charges repel, so it takes energy to force more protons in an already proton-rich area.
ATP Synthase
The intermembrane space has a lot of potential energy. Protons keep bouncing off each other, so their energy can be harvested to do work. Protons want to leave the highly concentrated intermembrane space, so they go through something called ATP Synthase. That acts like a turbine, and the flowing Hydrogen ions (or protons) make the ATP Synthase spin. The spinning ATP Synthase makes Phosphorate groups combine with ADP to create ATP. NADH usually releases enough energy to create at most 3 ATP, and FADH2 is able to create at most 2 ATP.