Cavitation is caused when the localized pressure at a point in the fluid falls below the vapor pressure of the fluid. In industrial settings, this effect is occasionally seen in centrifugal pump impellers, where the liquid entering the "eye" of the impeller experiences a sudden drop in pressure as the liquid is accelerated through the impeller and the liquid velocity rises rapidly (i.e., per the Bernoulli equation). The resulting low pressure causes small vapor bubbles to form.
The vapor bubbles formed from cavitation have a very short lifetime, because as the fluid flows through the pump impeller, its pressure quickly rises as it gets pushed against the pump casing, before it is expelled out of the pump discharge nozzle. This sudden increase in pressure causes the cavitation bubbles to collapse violently, creating a tiny shock wave as they do so. If this collapse happens on the surface of the pump casing, it causes a tiny pit to form as the shock wave blasts a tiny bit of metal away. Continued operation under these conditions will lead to enough pitting to destroy equipment.
Other conditions can also lead to cavitation. If a sufficient power density of ultrasonic sound waves are introduced into a liquid such as water, the low pressure points in the longitudinal sound wave will create cavitation bubbles which will collapse an extremely short time later as the high pressure part of the longitudinal sound wave passes the bubble. This often produces high enough temperatures to produce sonoluminescence (see https://en.wikipedia.org/wiki/Sonoluminescence). Temperatures created during sonoluminescence can indeed be extremely high, as referenced in the Wikipedia article.
Regarding prevention of cavitation in water pumps, there are several process changes that can be implemented:
1) Decrease the fluid temperature entering the pump. This will lower the vapor pressure of the fluid, meaning that the pressure at which cavitation occurs will be lower, and hopefully below the lowest pressure that the fluid experiences in the pump casing. This change can be implemented via process changes upstream of the pump, running a continuous stream of cold water on the pump inlet line and pump casing, installing a small heat exchanger on the pump suction line, etc.
2) Increase the suction pressure on the pump. This action will increase pressures throughout the pump casing, and hopefully increase the lowest pump casing pressure above the cavitation pressure.
3) Buy the next larger size pump in order to lower the suction line and pump casing velocities, such that the instantaneous pressure dip in the pump casing is not large enough to produce cativation.
4) Talk to a pump vendor, and try to specify a pump where the cavitation takes place entirely in the bulk liquid, where it can't impinge on any metal surfaces, and hence, can't do any damage.