Some high-school chemistry:
An atom consists of a number of positively charged protons encased by shells containing the same number of negatively charged electrons. The shells form by the attraction of opposite charges and in spite of the repulsion of like charges. The innermost shell has but one "position" where bonds can form whereas others have four positions to accommodate the repulsion of like charges. The four positions in outer shells are tetrahedrally distributed around the nucleus containing the protons where each position contains 0, 1 or 2 elections (though no position in a shell contains 2 when other positions contain 0). For positions with single electrons, the electron may be shared with a single electron from another atom to form a covalent bond, tying the two atoms into a molecule.
Two atoms form bonds with each other by sharing pairs of electrons from their outermost shells. The hydrogen atom has but a single proton and thus but a single electron and so can bind only one other atom. Consequently a hydrogen atom can participate in a chain of atoms only as a terminator. An oxygen atom has 8 protons and thus 8 electrons, 2 in the inner shell and 6 in the outer shell with two positions with single unpaired electrons. Consequently under biological conditions, an oxygen atom can bind two other atoms or even form a double bond with one other atom. Similarly carbon with 6 protons can bind up to four other atoms and nitrogen with 7 protons can bind up to three.
Methane is a carbon atom bound to four hydrogens:
As you can see the molecule is symmetrical but, if one, two or three hydrogens are removed it is no longer so. Likewise a water molecule, an atom of oxygen bonded to two hydrogens, is necessarily asymmetric:
The consequence of asymmetry is that the internal charges of the molecule are not evenly distributed so that one end has a net partial positive charge and the other a net partial negative charge. Multiple identical molecules will then tend to align so that the opposite charges face each other forming a weak so-called ionic bond. This bond when one atom is hydrogen is termed a hydrogen bond, which, because of peculiarities of hydrogen, is stronger than other ionic bonds and is thought to even have some covalent properties.
Each water molecule with hydrogens on two of the four binding positions and electron pairs on the other two positions can make hydrogens bonds with two other water molecules forming the crystal structure we know as ice when temperatures are below the freezing point. At biological temperatures, the thermal vibration of the molecules disrupts enough of the hydrogen bonds such that water is a liquid but no so many that it becomes a gas.
Other molecules such as polypeptides can also form hydrogen bonds with water and this is in fact how water acts as so effective a solvent. Further, thanks to a phenomenon called resonance, ultra-pure water can even attack glass and metals. Resonance explains how helium can be made a liquid even though its atoms are perfectly charge-symmetrical. The theory is that, for two adjacent helium atoms at a given instance, their electrons could be positioned such that the atoms have some degree of charge separation that causes the two atoms to attract each other. Of course as likely, the electrons will position such that the two atoms repel each other and so no net attraction would be expected. The attraction event, however, is self-reinforcing whereas the repulsion event is self-diminishing. In the attraction event, the molecules in a sense move closer increasing the strength of the attraction whereas they move apart during the repulsion event diminishing the strength. Though this affect is overwhelmed by other forces compelling the movement of electrons, it can set up a resonance where the electrons move in paths to maximize attraction.
In pure water, such a resonance can occur through the entire mesh of hbonds effectively energizing water molecules in contact with the vessel walls sufficient to cause corrosion. Even the minor amount of impurities in tap water is sufficient to break-up the mesh such that tap water is much less corrosive than distilled water.
A chain of hbonds exists in the helical form of polypeptides and likewise resonance can energize atoms at the ends of the chain. Furthermore, resonance can cause attraction between any two atoms and such so-called dispersion bonds also play a role in protein folding. Though weak, dispersion bonds are numerous in large molecules and their contributions to 3D structure are likely significant.