Hydrogen Bond: Theory of Hydrogen Bonding
When hydrogen (H) is covalently bonded to a highly electronegative atom X (O, N, F), the shared electron pair is pulled so close to X that a strong dipole results.

Since the shared pair is removed farthest from H atom, its nucleus (the proton) is practically exposed.
The H atom at the positive end of a polar bond nearly stripped of its surrounding electrons, exerts a strong electrostatic attraction on the lone pair of electrons around X in a nearby molecule.
Thus :

The electrostatic attraction between an H atom covalently bonded to a highly electronegative atom X and a lone pair of electrons of X in another molecule, is called Hydrogen Bonding.
Hydrogen bond is represented by a dashed or dotted line.
Characteristics of Hydrogen Bond
(1) Only O, N and F which have very high electronegativity and small atomic size, are capable of forming hydrogen bonds.
(2) Hydrogen bond is longer and much weaker than a normal covalent bond. Hydrogen bond energy is less than 10 kcal/mole, while that of covalent bond is about 120 kcal/mole.
(3) Hydrogen bonding results in long chains or clusters of a large number of 'associated' molecules like many tiny magnets.
(4) Like a covalent bond, hydrogen bond has a preferred bonding direction. This is attributed to the fact that hydrogen bonding occurs through p orbitals which contain the lone pair
of electrons on X atom. This implies that the atoms X–H...X will be in a straight line.
Example of Hydrogen Bonding - Hydrogen Fluoride, HF
The molecule of HF contains the strongest polar bond, the electronegativity of F being the highest of all elements.
Therefore, hydrogen fluoride crystals contain infinitely long chains of H–F molecules in which H is covalently bonded to one F and hydrogen bonded to another F.
The chains possess a zig-zag structure which occurs through p orbitals containing the lone electron pair on F atom.

Example of Hydrogen Bonding - Water, H2O
In H2O molecule, two hydrogen atoms are covalently bonded to the highly electronegative O atom.
Here each H atom can hydrogen bond to the O atom of another molecule, thus forming large chains or clusters of water molecules.

Each O atom still has an unshared electron pair which leads to hydrogen bonding with other water molecules.
Thus liquid water, in fact, is made of clusters of a large number of molecules.
Example of Hydrogen Bonding - Ammonia, NH3
In NH3 molecules, there are three H atoms covalently bonded to the highly electronegative N atom.
Each H atom can hydrogen bond to N atom of other molecules.

Example of Hydrogen Bonding - 2-Nitrophenol
Here hydrogen bonding takes place within the molecule itself as O–H and N–H bonds are a part of the same one molecule.

TYPES OF HYDROGEN-BONDING
Hydrogen bonding is of two types :
(1) Intermolecular Hydrogen bonding
This type of hydrogen bonding is formed between two different molecules of the same or different substances e.g. hydrogen bonding in HF, H2O, NH3 , Amides and Polyamides.
It is shown in the following diagram

Amide

Polyamide
Another examples are (a) RCOOH [Carboxylic acid] and (b) ROH [Alcohol]

This type of hydrogen bonding results in the formation of associated molecules.
Generally speaking, the substances with intermolecular hydrogen bonding have high melting points, boiling points, viscosity, surface tension etc.
(2) Intramolecular Hydrogen bonding
This type of hydrogen bonding is formed between the hydrogen atom and the electronegative atom present within the same molecule.
It results in the cyclisation of the molecule.
Molecules exist as discrete units and not in associated form.
Hence intramolecular hydrogen bonding has no effect on physical properties like melting point, boiling point, viscosity, surface tension, solubility etc.
For example intramolecular hydrogen bonding exists in o-nitrophenol, 2-nitrobenzoic acid. as shown below




