Atoms bond together because in doing so, they can achieve a lower overall energy. In simple terms, making bonds releases energy, and breaking bonds requires energy.
The bonds we most often come across in organic chemistry are covalent bonds. These are bonds where electron pairs are shared between atoms, usually with one electron from each pair coming from one atom.
We also need to note the octet “rule”. This is only really a rule of thumb, and has many exceptions, but it can be noted that a great many compounds obey the rule, which is:
Many main group elements have a tendency to take on the electronic configuration of the noble gas at the end of their period. e.g. methane (CH4) carbon starts with 4 valence electrons, and gains one from each hydrogen to get a full complement of 8.
How do the previous discussions of atomic orbitals factor into the nature of bonding? Perhaps this simplest way of considering a chemical bond is as an overlap of two atomic orbitals:
The diagram above shows the overlap of two H 1s orbitals to form a new ovoid molecular orbital. The new orbital has one electron from each atom.
For the reaction above (i.e. the formation of H2 from two hydrogen atoms), a bond is made, and hence energy is released (436 kJmol-1).
Where are the nuclei of the two hydrogen atoms now? There is an optimal distance for their displacement. If they are too close, the two positively charged nuclei will repel each other. If they are too far apart, the overlap of orbitals will be ineffective, and hence the bonding very weak:
This is a diagram to represent the energy of the system as the internuclear distance changes. The zero level is the energy level of the two dissociated hydrogen atoms.