Below is the structure of a water molecule:
This is a rather helpful diagram for discussing the first two factors, and I shall show another one shortly to explain how the last one comes into play.
The polarity of the
The second factor is a water molecule's shape. The central oxygen atom has two lone electron pairs and two bonding electron pairs; thus, the molecular geometry is v-shaped/angular/bent. The bent shape means that a water molecule has a permanent dipole or dipole moment; without this, hydrogen bonding would not be possible as charges along the molecule would counteract.
Here is another diagram, this time showing two water molecules and a hydrogen bond existing between them:
This diagram does not show partial charges, but simply put the hydrogen atom is very electron deficient and so exhibits quite a strong - yet still only partial - positive charge, whilst the lone pair is effectively a region of negative charge that is associated entirely with the oxygen atom. The resulting attraction is what is known as a hydrogen bond, so it is intuitive to conclude that lone pairs are also essential for hydrogen bonding to take place.
As a final note and as a suggestion for a bit of further reading, I shall tell you that hydrogen bonding is directional: can you suggest why that might be, by looking at the diagram above? I hope I have helped in answering your question, and wish you well in your studies.