Raw files are an intermediate format. It's essentially the unmodified sensor data (often in Bayer pattern), packaged with a bunch of metadata about the shot as well as a JPEG preview (for quick viewing). The data is both losslessly compressed and of a higher bit depth than that of JPEG.
You only need to shoot raw if you wish to develop the photos into JPEGs, or other destination formats such as TIFF or PNG, yourself by using a software suite. This has many benefits to photographers wanting to take their photos beyond the camera, as well as provides the ability to extract information that might otherwise be lost. For example, bringing out detail in shadows, bringing back detail lost in highlights.
A raw file is analogous to a film negative in the fact that you can keep producing different versions of a photograph by manipulating settings such as contrast, saturation, white balance, black and white etc.
The main thing to note is that raw files are nothing more than the base data for creating a JPEG representation. They're not some better format of photo, because they're not the format used to print or to upload to the internet. They're the egg and you are the frying pan. Shooting JPEG means the camera fries the egg for you, in a way you may or may not like. I personally don't take the chance.
- JPEG compression discards information in the image to reduce the size, raw does not.
- JPEG can only store 8 bits of information per component (red, green, blue), where a raw file may contain 12 - 14 bits for most DSLRs these days. The pixel data in a 14-bit raw file is 64 times more detailed than a JPEG.
- Changing white balance and many other basic settings can cause severe loss of quality in a JPEG, with raw you are essentially starting from scratch with the highly accurate data.
- Raw files are typically 2 to 5 times larger because of the compression and bit depth of the data.