Why do atoms tend towards electrical stability?

An $\text{O}^{2+}$ ion, with 6 electrons, is stable in a vacuum. If you put one in the depths of interstellar space, far from any other matter, then it will sit in that state until the end of time.

Similarly, you can have a high-elevation lake, and it can be absolutely stable if there is no path for water to drain out.

Also, is an atom being stable identical to it being neutral?

So no, as shown by that example, it is not the same thing.

However, of you have a higher-elevation lake and another one whose water level is 10 meters lower, and they're connected by a stream bed, then water will drain out of the higher one until the two surfaces reach an equal level. The stable state is the one that has the minimum energy (minimum total gravitational potential energy of all the water). This is analogous to what happens when oxygen and hydrogen are mixed. The electrons are like the water.


Wanting or favoring are not very good terms in physics. More scientific view on this would be that whenever an oxygen atom comes close to another atom, they interact and provided things are right (such as the number of electrons and their state), the atoms attract and can get closer, while losing part of their initial energy, in the form of radiation or lost electron or transfer some energy to other atom/molecule in a scattering event.

After the binding energy is lost from the pair to the surrounding space, it becomes more probable it will stay together, until required energy for its breaking is supplied from outside the system. This can be EM radiation with the right spectral characteristics, or some other particle that moves nearby and cleaves the bond.

For the air in troposphere, the available mechanisms to supply so much energy (collisions, cosmic particles) can only do so for very little fraction of molecules, so majority of oxygen atoms will exist in pairs, much lower number in triplets and so on. The situation is different in upper layes of atmosphere, where UV light and cosmic particle are more intense, so greater proportion of gas particles may be in exotic form such as unpaired oxygen atom.


Also, is an atom being stable identical to it being neutral?

No, not at all: many atoms are more stable after they've either absorbed (an) electron(s) or shed (an) electron(s).

A good example is the formation of table salt, $\mathrm{NaCl}$, aka sodium chloride.

This compound forms when sodium atoms lose an electron (the valence electron), as in:

$$\mathrm{Na}\to \mathrm{Na^+}+ \mathrm{e^-}$$

Similarly the choride atoms can absorb an electron:

$$\mathrm{Cl_2}+ 2\mathrm{e^-}\to 2\mathrm{Cl^-}+ 2\mathrm{e^-}$$

When those ions combine we get:

$$2\mathrm{Na}+\mathrm{Cl_2}\to 2\mathrm{NaCl}+\Delta H$$

$\Delta H$ is the energy released in the process. The arrangement of these elements in the ionic lattice $\mathrm{NaCl}$ is more stable than the combination of the (unreacted) elements.

By losing its 'lone' $\mathrm{3s^1}$ valence electron, sodium takes on the very stable electron configuration of neon. Similarly, by absorbing an electron into its $\mathrm{3s^23p^5}$ valence electrons, it assumes the very stable electron configuration of argon.