Hair cells in the cochlea are moved by the vibrations of the cochlea and of the fluid in the cochlea caused by sound waves. The cells at the base of the hair cells convert their motion into electrical signals to be sent up the acoustic nerve to be interpreted by the brain as sound.
Actually, the hair cells are not really hair; but the behave somewhat like hair might.
Damage to hair cells (or the lack of them) is one of the major causes of hearing loss. Research is underway with a goal of being able to regenerate hair cells. Some other animals can, in fact, do this, but humans cannot, yet. Perhaps with the help of science and medicine, we will, one day, be able to restore hearing for many people using hair cell regeneration.
There are many thousands of hair cells in a healthy cochlea. Some longer and more flexible hair cellls wave or vibrate because the vibrations in the fluid of the cochlea is transmitted to them. Others, which are shorter and less flexible, are physically moved by overlaying structures within the cochlea.
Different hair cell respond to different frequencies and give us our amazing ability to differentiate among frequencies of sound.