There are probably 20-odd file formats available for images, but I'll only deal with a few of them here - raw, jpg, tiff and psd.
Raw files come from digital cameras, and are completely different from other formats. A raw file can't be viewed in its original state, it has to be rendered by a raw converter like Lightroom or Camera Raw before it can be viewed.
A raw file is a 12 or 14-bit one channel greyscale file. It has no colors, but contains color information. The raw converter reads the color information and creates a new file, based on the raw file, in RGB. A raw file contains all the information from the camera sensor, and is analogous to a film negative, both in the sense that it contains a lot of information, and in the sense that it is open to interpretation. Any editing done to a raw file is non-destructive, the edits are stored as metadata, and are only applied to the new file - when you export from Lightroom, or save the file in Photoshop. The original raw file remains unchanged.
Shooting raw gives you the ultimate control over your photographs, and, properly processed, the results will be superior to jpg in every way. The downside is longer processing time and larger file sizes, but since raw files are greyscale, they are much smaller than RGB tiff files with the same dimensions. For instance, the NEF files from my Nikon D7100 are around 30 MB, and converting them to DNG reduces their size to around 25 MB (DNG uses lossless compression). Exporting these files as uncompressed tiffs from Lighroom results in a file size of 68.7 MB as 8-bit and 137.3 MB as 16-bit.
All high-end and some low-end cameras can shoot in raw. Camera manufaturers have their own proprietary raw formats. like Nikon's NEF format and Canon's CR2. Adobe has developed the open DNG (Digital Negative) format, which can be used freely by anyone, but unfortunately very few camera manufactureres have adopted it. Leica is one notable exception. For those who want to convert their raw files to DNG, Adobe has provided the free DNG converter. It is also possible to convert proprietary raw files to DNG when importing in Lightroom, which can also export DNG files.
When shooting raw, many camera settings have no effect on the image - like sharpening, noise reduction, picture modes, and color space (a raw file has no color space). The settings that do affect the image are exposure (f/stop and shutter speed), ISO speed and white balance. Raw files contain a jpg preview, which is what you see on the back of the camera, and in programs that can't render raw files, like the Mac Finder or Windows Explorer. The camera histogram is also for the jpg preview.
The jpg format is 8-bit only, and uses lossy compression to create smaller file sizes. Lossy means that there is some degree of image degradation involved. When saving or exporting a jpg, you can choose a quality setting between 0 and 100 (0-12 when saving in Photoshop). The zero setting will create a very low quality file with lots of arifacts, but the file size will be tiny. The 100 setting will create a high quality file, in most cases with no apparent quality loss, and the file size will still be much smaller than the original.
The file size of a jpg is also largely dependent on image content. A busy image with lots of detail will be much bigger than an image with large flat areas. Excessive sharpening and/or noise will also increase file size. The difference in file size can be quite dramatic - see the two images below, both exported at 80 quality from Lightroom.
The top image needs the 80 quality to avoid compression artifacts in the blue sky, whereas the bottom image only needs 30 - 40 for the landscape, but the sky needs at least 50 to look good. So although busy detail means a larger file, you can get away with a lower quality setting, provided there aren't any important flat areas in the image.
Jpg is a final format, and is not meant to be edited. In fact, repeated edits and saves will rapidly deteriorate the image. The exception is non-destructive editing in Lightroom or Camera Raw. I only use jpg for images going on the web or for other screen viewing, and sometimes clients will ask for high resolution jpgs, which are always exported at 100 quality. For printing I always use tiff.
Tiff is the industry standard for high resolution, high quality images. Virtually every image viewer and editor can open an uncompressed tiff file. When saving a tiff in Photoshop, there are three choices for optional compression - LZW, Jpg and ZIP.
I don't use LZW, because it does not work well with 16-bit files - it will increase the file size instead of reducing it. And jpg is out of the question, since it uses lossy compression.
ZIP compression is lossless, and works very well with 8-bit files - depending on image content, file size reduction will be around 30 - 60%. With 16-bit files the reduction will be around 10 - 25%. I also use ZIP compression for layers. ZIP compression has one disadvantage, saving takes much longer than when saving uncompressed. Not all applications can read and open compressed tiffs, so I always send uncompressed versions to clients.
PSD is Photoshop's native file format, and may have advantages in some workflows. There is no difference in quality between PSD and Tiff, but I stick to tiff because of the slightly better compression, and because it is so widely supported.