Each segment of the basilar membrane is "tuned" for a particular pitch, so only hair cells within a certain pitch will be moved. As the basilar membrane vibrates, the hair bundles at the top of the hair cell bend back and forth and slide against one another. A tip link protein connects the tip of each stereocilia to an ion channel in its neighbour.
As the stereocilia bend, the tip link pulls on the ion channels and opens them. These channels allow potassium ions to enter the hair cell.
As the potassium ions enter, they depolarise the cell. This depolarisation spreads quickly along the plama membrane and calcium ions also enter the cell. This influx of calcium causes excytosis of synaptic vesicles containing a neurotransmitter. As more neurotransmitter is released, the frequency of nerve impulses in the sensory neuron increases.
Bending of the stereocilia in the opposite direction allows repolarisation and reduces neurotransmitter release, thus decreasing the frequency of nerve impulses in the sensory neuron.
Images courtesy of Wiki Commons