Please skip the article if it scares you. If you are in doubt about WB or exposure, ALWAYS shoot in RAW.
The photographers of advanced levels of knowledge about color representation and compression surely know that RAW files contain a huge amount of additional useful data as compared to a JPEG. A RAW may contain 14 or 16 or sometimes 32 bits of data per color channel. A 16 bit TIFF contained from a RAW of equal bit depth would give you (2^16)(2^16)(2^16) unique colors and intensities. An 8 bit JPEG would give you a few million times smaller color depth.
A RAW contains a higher "dynamic range" of data. Just like your eyes see both shadows and lights but a camera doesn't see both at the same time...but it still retains fine detail in shadow regions when you go for a RAW image capture mode. In post processing, you can modify the intensity levels of each pixel by 65,536 different levels. This feature enables you to do a "lossless" post processing. You can step up exposure without really turning the black areas grey. But a JPEG contains only 256 different intensity levels....which is 256 times smaller depth than of a 16 bit TIFF. VERY little information and shadow details retained.
Looking into the depths of binary representation of pixel outputs and color representations, you can easily overcome some shortcomings of JPEG. I love the JPEG mode and I do all my post processing in JPEG with a minimum loss of details. The only thing that you cannot get rid of in JPEG is artifacting like noise and compression artifacts (DT calls it "distorted pixels" most of the time). So I'd like to shoot RAW when I'm shooting scenery where there are details all over. But while shooting simpler subjects where there are no extremely minute and important details, JPEG is the best options in terms of size and burst rate/buffer limits of your equipment.
Overcoming exposure dynamic range limitations of JPEG
Shoot a JPEG at ISO 400 or something like that and suppose you found your image grossly underexposed. If you had used RAW, it already contains enough shadow details and you can simply pull some slider and make it bright. What if it was a JPEG? If you try using the exposure adjustment tool or brightness adjustment tool, you'd have severe, unacceptable noise levels. Wonder why?
NOT because your JPEG "doesn't contain enough info". Your JPEG contains info to quite some impressive levels. You should just understand it at the binary levels. The brightness or exposure tool of Photoshop would mess with the "response curves" of your imaging equipment. It would brighten the midtones while barely touching the shadows and highlights. This increases/decreases contrasts inequally and intensifies noise.
Duplicate the layer which contains your underexposed image. Set the blending mode to "linear dodge" or "screen". It amplifies the pixel values equally and proportionately, maintaining the linear response curve characteristic shown by all digital imaging equipment.
For example: If there are three pixels. A, B and C... Let us assume A(3,3,3) and B(100,100,100) and C(250,250,250). These values represent the RGB pixel values.
For brightness adjustment tool, this is how it works:
A(3,3,3) becomes (4,4,4)
B(100,100,100) becomes (130,130,130)
C(250,250,250) doesn't even change.
As a result, the noise, which is usually around a different range than the rest of the image gets intensified in comparison to the remaining image. The gain of main signal and noise signals are different, widening the gap (contrast) and showing excessive noise.
When you use linear dodge (add) mode, the layer's contents are simply added to the contents of the layer below. Suppose the previous pixels are carried up in a duplicate layer and then the mode is changed to linear dodge, this happens:
A becomes (3+3,3+3,3+3) = (6,6,6)
B becomes (200,200,200) from (100,100,100)...etc
The contrast is conserved and noise and image pixel intensity gains are equal which give you a very low visible noise level.
When you use the "screen" blending mode, it adds a definite amount of value depending on the image. The algorithm is complex and I'd not go into the details. But screen mode is the most effective in increasing brightness of images without losing details in the shadows and keeping noise minimum.
If you can relate other functions of Photoshop or any other software similarly, you can process your JPEGs with the minimum possible loss of details and with the best possible noise performance which matches the quality of RAW if correction is upto +-1/3 stops (channel specific independent values).
Agreed, a JPEG is still around 0.5% of the information contained in a RAW, but you can make the best use of it. These processes would help you with compact camera photos a lot where you cannot shoot RAW at all.
I suspect if you really read the complicated stuff, it's boring I suppose...but it is easy and interesting when you get to understand it. I have been into this stuff since I was 15. No doubt you can do it way better than me. Good luck with future shooting! :)