In a compound, atoms are bonded together by electromagnetic forces. Each bond between atoms has a specific bond energy - the energy required to break it - called the Bond Dissociation Enthalpy. For example, a C=O bond has a bond energy of 805KJmol-1. Most bond enthalpies are average enthalpies, the arithmetic mean of the energy required to break the bond in all (most) compounds.
The greater the energy of the bond, the shorter the bond length. Between two atoms, there are attractive forces between the positive nuclei and the negative electrons, but there is also a repulsive force between the two positive nuclei, which increases as the atoms get closer together. So it can be seen that there is an equilibrium point reached whereby the distance is such that the energy is greatest and the forces of attraction and repulsion are equal.
The change in energy of a reaction can be calculated by adding the bond enthalpies of all the bonds in the reactants and subtracting the bond enthalpies of all the products. For example, the reaction N2H4 + O2 → N2 + 2H2O has an energy change of -581.1 KJmol-1. The calculated value may differ from the ΔHrO because some compounds are not in their standard states and average bond energies are used, rather than ones specific to the compounds in the reaction.