Why is it energetically favourable for molecular bonds to form from a QM point of view? For example, if you have two hydrogen atoms and an oxygen atom, they are all electrically neutral and don't attract each other. But then if they manage to get "close enough" somehow they snap together releasing energy, and to get them apart again requires energy be input into the system. 
This says that the bound state is a 'lower energy' state than the unbound state, and this is my question: 

From a Quantum Mechanical point of view, where does this energy come from that is released when the bond is formed? 

I've done some reading and it has something to do with filling electron shells and electron probability wavefunctions spreading between atoms, and something about the Virial Theorom where the kinetic energy of the electron is reduced as it's range of area is increased. 
But that doesn't make sense to me, so I was wondering if someone could explain where the bond energy released comes from in terms of the electron wavefunctions? Assume high school physics/freshman maths.
 A: I don't think it helps understanding much to bring the virial theorem in, but the thing about the range is increased is pretty much the key.
First, why the range is increased – well, there used to be one proton to swirl around and now there are two, easy.
Why this is energetically favourable is another matter. I'm afraid you'll have to look at the Schrödinger equation here:
$$
  \bigl(E - V(\mathbf{x})\bigr) \cdot \psi(\mathbf{x})
    \propto \tfrac{\partial^2}{\partial \mathbf{x}^2} \psi(\mathbf{x}).
$$
Read this as: "it takes energy to bend the wave function". But the smaller you constrain your electron's range, the more you need to "bend" the wave function.
To make this concrete:


*

*The wave function is a smooth function on all space.

*It needs to become zero as you approach infinity.

*It must be normalised: $\int_{\mathbb{R}^3}\mathrm{d}\mathbf{x}\:|\psi(\mathbf{x})|^2 = 1$. From a Born-probabilistic view this just means: the probability to find the electron anywhere in all space is $1$. (After all, it can hardly escape the universe, can it?)


To fullfill those points, you obviously can't use a wave function that's $0$ everywhere: it wouldn't integrate up to $1$. You need to have some kind of bulge around the proton(s). The integral is something similar to the "volume" of this bulge, if it were something like an ocean wave. So the wider you spread the bulge (i.e. the region in which the electron is typically found), the more shallow it can be. And a more shallow bulge requires less bending of the wave function! Hence it is a state with lower energy, i.e. energy is released as you increase the range of the electron.
A: The energy changes come from changes in a) the electrostatic energy between the electrons and the protons as well as b) the reduced kinetic energy of the electron. 
The electrostatic energy changes because the geometrical configuration of the proton and electrons are now different, while the electron KE changes because the electron is more delocalized (larger $\Delta x$) and hence has smaller momentum (smaller $\Delta p$, which implies smaller minimum $p$); this is the same reason why electrons can't approach arbitrarily close to the nucleus in an atom.
For $H_2$ at least, (a) is actually energetically unfavourable! It takes energy to concentrate the electron wavefunction into the internuclear region, and that energy comes from the reduced KE of the electron. (http://www.users.csbsju.edu/~frioux/26rio897.pdf)
