There are a number of video formats that are used for compressing and distributing videos these days. While most use common and open standards such as H.264 that are readily viewable, others may be more obscure and will require you to install a codec to view videos encoded in them.
While Apple advocates the use of codecs that are supported in QuickTime (primarily H.264), one of the most commonly used codecs is Microsoft's WMV, which used to require the installation of Windows Media Player for the Mac, but support has been wrapped into the "Flip4Mac" codec. This is available for free to play videos, but if you want to encode with it, you will need to pay for a license.
Beyond WMV, there are a variety of open-source codecs that you may need at some point. While for many you can install the individual codec when needed, I've found the easiest way to ensure you can view these formats is to install a single solution for handling a variety of codecs. There are several solutions for this, which include codec packs for QuickTime, and third-party players.
This is a popular codec pack for quicktime that includes support for DivX, XviD, FFMpeg, and numerous others. It is built solely for QuickTime, so you will not have to install another media player.
This is an open-source project for developing a widely used alternative media player that supports most video codecs available. The player is well-built, and while there are some interface limitations because of recent limited developer support for OS X, it still is a viable option that works well.
Like VideoLAN Client, MPlayer OS X Extended is another media player alternative that includes support for a number of codecs. It comes with support for most common ones, but has the option for including a codec pack (available here) that adds support for most codecs available, including development and beta versions.
Have any additional codec recommendations? Post 'em in the comments! There are many out there.