The purpose of white balance is to tell the camera what color temperature of light is being used to shoot the scene.
Our eyes and brain automatically make adjustments as we use them to see the real world the camera can't.
The camera can only deal with 1 color temperature in each photo.
If you shoot a scene lit by more than 1 kind (color temperature) of light source (known as 'mixed' lighting), post process you can only
fully correct for
1 of the light types (color temperature), or
partially correct for all the light types used to light the scene.
So controlling white balance starts before you release the shutter by noting what types of light source are lighting the scene you are shooting.
Understanding White Balance
Incandescent/tungsten lights have a lower color temperature than fluorescent lights do, and fluorescent lights have a lower color temperature than sunlight has.
If set your camera white balance to sunlight and then use tungsten lighting your photos will have an orange-ish color cast.
If set your camera white balance to sunlight and then use fluorescent lighting your photos will have an green-ish color cast.
Color temperature - Wikipedia, the free encyclopedia
Portrait photographers that shoot outside can use white balance to help separate their subject from the background with color.
They use flash, gel the flash to the color temperature of tungsten lighting using a CTO gel, and set their camera white balance to Tungsten.
Light from the gelled flash then looks like sunlight on the subject, but the background ambient sunlight has a nice soft blue-ish color cast to it making the subject look nice and warm.