Well, there's quite a lot to color theory, but here is a relatively simple, practical way of thinking about it. All of the colors in your digital image are stored in a fashion that defines them in terms of their red, green, and blue components. So any given picture element (pixel) has a set of three numbers associated with it, the amount of red, green, and blue. There are other ways of defining a pixel's color (LAB, HSM, YUV, etc.), but a particular form of RGB is the most common. You'll sometimes see this referred to as "24-bit RGB", or "8-bit RGB", because each color has a numeric value from 0-255, which is the range it's possible to store in 8 binary bits, and there are three colors stored, hence 3x8=24 bits.
As a result, any neutral color from black (R=0, G=0, B=0) to white (R=255, G=255, B=255) with all the grays in between should nominally have each component be equal. Of course in real life, this is rarely the case. If you have an 18% gray card and you shine a reddish light on it (or, say, sunlight at sunset), and take a photo of the light reflecting off of it, then the red component of a pixel from the card will have a higher value than green and blue, and likely they won't be exactly equal to each other either.
But because this is all numbers, essentially, you can apply a calculation to change the numbers to account for the color cast and return the colors in the image to a more neutral balance. You pull that red value back down to being equal with the others, and apply the same adjustment to all the colors in the image. This is altering the white balance. Of course, you don't have to go neutral: you can apply a color cast as well as taking it away.
An interesting note is that your brain does this for you automatically. When you look at a snowy field, your brain tells you that it's white, independent of whether it's under a blue sky, reflecting all the blue, or under a sunset, reflecting similarly. The brain tries to adjust things more or less unnoticeably so we still see the snow as white. Digital cameras see what ever is there, and its "Auto White Balance" technology, when used, tries to do what our brain does. If you know the illuminant type (e.g., the sun, or "Daylight", shade, tungsten light, fluorescent light, etc.) you can set the corresponding white balance preset, and the camera will adjust the colors it records accordingly.
Some tools refer to color temperature, which is measured in degrees Kelvin. This is the color that a "black body radiator" (something that doesn't introduce it's own color, just the color radiated by energy) would yield if it were at that temperature. Daylight varies, of course, so different standards have been adopted for different purposes. The range starts about 5500 degrees Kelvin and goes up; 6500K is another standard, called D65, and used for calibrating some devices. The "warmer" colors have lower color temperatures, and the "cooler" colors have higher color temperatures: think of the colors associated with fire: "red-hot" vs. "white-hot". The reason I mention it is that some digital processing programs, such as RAW converters, that have controls for working with white balance talk about it in terms of color temperature, and let you vary the white balance according to a color temperature slider, for example.
Hope that was at least somewhat clear; it's a quick brain dump of my understanding of the subject.
Last edited by Brazile
on Fri Jun 13, 2014 8:34 am, edited 1 time in total.