Depends on the unit. On some designs (e.g. Velodyne HDL-64) the unit is split into two sections. The whole upper section, along with all the optics and some of the electronics, spins at 10-15 Hz, which naturally tends to shed precipitation and other crud.
Sensors with non-moving optical windows can use other strategies, such as air knives or wipers.