Filling the Valence Shell
Oxygen, being the 8th molecule,
has 8 electrons with a full inner valence shell of 2 electrons, and 6 electrons on the outer valence shell. Sharing electrons with Hydrogen completes it's need to have a balanced charge between negatively charged electrons and positively charged protons.