You identify lone pairs by drawing a Lewis structure.
For example, the Lewis structure of water is
The electrons between the O and H atoms are bonding pairs.
The electrons that are not between the O and H atoms are lone pairs.
The number of lone pair electrons plus the number of bonding electrons equals the number of valence electrons around an atom.