When I teach someone photography, one of the things that I make sure the student knows is how the camera meters a scene. Once you understand how the camera meter actually works, you learn that your camera isn't as smart as you thought it was.
Sure, modern cameras do a pretty good job at metering for an evenly toned scene. Throw a bright background behind a subject or a bright subject on a dark background, and you'll quickly see that the camera doesn't meter accurately. Exposure compensation is used to make up for this shortcoming of the metering system. However, many photographers don't know exactly how it works.
In this video, Steve Perry from Backcountry Gallery explains just about everything you would ever want to know about exposure compensation. Starting with what it does and what it adjusts, Perry explains what settings the camera changes and in what order when shooting in one of the automatic modes.
Using real-world examples, Perry shows how exposure compensation can help with various scenes. Much of this comes with experience, but you'll know when to use exposure compensation once you understand the situations that may throw off the exposure metering.
Not stopping at just explaining exposure compensation, Perry also ends the video by explaining the differences between full manual mode and using exposure compensation. If your camera also supports exposure compensation in full manual mode, Perry also explains how that works.