This is NOT exactly the way it happens but the idea of what happens
If you look at the drawing you will see that when you take a picture in JPG mode the data will go though a lot of different steps before it is written to the memory card. The camera does the same thing to each picture.
Think of going to the doctor and he give the same medicine to everyone, no mater what is wrong with them they get the same thing. Well that will work in a lot of cases but not all of them.
In RAW mode the camera takes the data right from the CCD and then sends it to the memory card, it adds with the file the information about how the camera was set, but it does not change the image data.
You are the doctor now, with editing software you can adjust each different image in a different way. This will get the best image you can from the raw data.
Raw file are much bigger then jpg files, they have not been compressed at all.
You can not look at a RAW file without converting it first with software.