Cameras have problems with underexposed and overexposed images because they can only accurately record the middle area of light between very dark and very bright. Cameras with WDR technology have advanced sensors that can produce a wider range of lighting, allowing them to record in a higher light depth.
Along with recording a larger range of lighting more accurately, WDR-enhanced cameras have two other ways of balancing light for better images. Tone mapping lets the camera or software automatically brighten dark areas and darken light areas.
Alternatively, the camera will capture several shots of the scene at different exposure levels. This creates overexposed and underexposed identical images, which the camera will combine. It takes the most balanced parts of both images, creating the recorded image you see. This method requires an extremely fast and light-sensitive sensor, however, and is only available on advanced professional cameras.