Ideally the contrast range of a sensor, such as that used in a camera, should be greater that the range of the intensity of the light that it receives from a scene.
In such a case, the resulting histogram will be smooth at both ends because the light received from the very bright and the very dark parts of the scene will be less than the light received from the other parts of the scene.
Unfortunately, this ideal is often not the case in reality, and illumination outside of the sensor's contrast range, arising for example from glossy highlights and especially dark parts of the scene, cannot be captured and is lost.
The result is a histogram that is saturated at one or both ends of its range.
The illumination values lying outside of the sensor’s range are mapped to its minimum or maximum values and appear on the histogram as significant spikes at the tail ends.
This typically occurs in an under or overexposed image and is generally not avoidable when the inherent contrast range of the scene exceeds the range of the system’s sensor.