This is a great question. I'll take a first try at answering, but maybe follow-ups will be needed.
It might seem as if two electrically neutral hydrogen atoms would not attract. There are, however, two reasons why they do. The first is a weak effect important at larger distances and the second is the strong effect responsible for forming the H2
The weak effect is that each atom can slightly distort, forming an electric dipole, at very little cost in energy. Those dipoles can align in a way to attract each other, so the energy can be reduced by a combined distortion plus having the atoms get closer. This weak attractive force is essentially universal. It accounts for why typical gases form liquids as they cool down.
For the formation of molecules by covalent bonds, we can't avoid explicitly talking about quantum mechanics. Say you had two hydrogen atoms near each other. Their electrons could each smear out over clouds big enough to include both protons. Here's the key point: the quantum mechanical kinetic energy depends on the size and shape of the electron clouds. The more spread out they are, the lower the energy. So by sharing the electrons, the atoms lower the net kinetic energy.
For the more sophisticated, there's another layer to the story. There's a virial theorem which says that the total energy (potential plus kinetic) for this sort of Coulomb system is just minus
the kinetic energy. So in order to bind, the net kinetic energy must go up, with the size of the negative Coulomb potential energy going up even more. What happens is that the molecule with the shared electrons shrinks down, increasing the kinetic energy to an even higher value than the separate atoms had, but in the process reducing the potential energy even more.
The key step in understanding why the molecule forms is still that bigger clouds can have lower kinetic energy, so that it pays for atoms to share electrons. There's no way of describing that honestly without quantum mechanics.
(published on 01/02/2012)