Caching can be set at various levels for SharePoint. Here we explore 4 different types of caching.
Site collection output cache
What
Caches rendered page outputs for anonymous and authenticated users.
Where
Site Settings > Site collection output cache (under Site Collection Administration).
Can also be set at site and page layout level.
How
"Office SharePoint Server 2007 uses output caching technology native to ASP.NET 2.0 to manage when and how page content is served. (...)
Each Web server uses the page output cache to store rendered output of all controls on a given page (...). While a page is cached by the output cache, later requests for that page by the users who have similar permissions are served from the output cache (...). The page output cache can improve server performance because it reduces server control activity and calls to the database."
from Caching in Office SharePoint Server 2007.
More
It is important to choose the proper cache profile for each type of user (anonymous vs. authenticated). MOSS already comes with different cache profiles for you to chose from.
For a public internet site I usually select "Public Internet" for the anonymous cache profile and "Extranet" for the authenticated cache profile.
You can also allow selection of the cache profiles for specific publishing sites and page layouts.
If you see an error when enabling Site collection output cache, then check Site collection output cache - List does not exist.
More information on how to manage Site collection output cache can be found at Output Caching and Cache Profiles.

Site collection object cache
What
Caches content, field and cross-list queries data.
Where
Site Settings > Site collection object cache (under Site Collection Administration).
How
"Office SharePoint Server 2007 supports caching of certain page items, such as navigation data and data accessed through cross-list queries. Caching page items reduces the requirement to retrieve field data from the database every time a page is rendered. The caching system also caches complete field data for a page, excluding data for any Web Part controls on the page.
(...) By using the object cache, you can greatly reduce the number of round trips required to serve cross-list queries. This improves the performance of features such as the Content Query Web Part that present cross-list query results."
from Caching in Office SharePoint Server 2007.
More
I normally set 200 MB for the output cache size. The other settings are related to cross list queries.
For a public internet site I usually limit cached results for cross list queries to 60 seconds and change the results multiplier to a low value such as 2 or 3, but this depends on the application.
For the multiplier it is advised to use a larger value when there are many unique permissions on lists and a smaller value when many users have the same permissions.
More information on how to manage Site collection object cache can be found at Object Caching.

BLOB cache
What
Provides caching for resource files such as images, scripts and stylesheets and also for image, sound and code files.
Where
In the web.config, the BlobCache element under SharePoint.
How
"(...) the BLOBs are retrieved from the database on the first request from each Web server and stored in a folder on the Web server file system for the expiration time required by the single item. Subsequent requests are served from the disk-based cache and trimmed based on security.
Use the BLOB cache to minimize database calls when the content database contains a lots of static content (.css files, XML files, HTML files, or attachments in article pages).
(...) Disk-based caching applies only to items in a document library. If you store resources outside a document library, such as a folder underneath a site, the items are not managed by the disk-based cache even if you enable disk-based caching for the Web application."
from Caching in Office SharePoint Server 2007.
More
It is disabled by default. You have to define a location in a disk where the cache will be stored, the maximum size for the cached files, the extensions of the files that should be cached, among other options.
E.g.:
- <BlobCache location="D:\data\blob" path="\.(gif|jpg|png|css|js)$" maxSize="2" max-age="86400" enabled="true" />
The maxSize property is in GB (the article Caching in Office SharePoint Server 2007 mistakenly claims that the size is in bytes - it is not, it is in gigabytes). You should make sure the drive has enough disk space. It is always best to specify a drive different than the C for this.
There is a known problem with cached files not working for anonymous users. This has to do with how SharePoint serves the files from document libraries such as the Style Library. You can find a solution for this at BlobCache, Style Library, and anonymous users.
More information on BLOB cache can be found at Disk-based Caching for Binary Large Objects.

Cache-Control HTTP header
What
Controls the expiration time of cached static files.
Where
Internet Information Services (IIS) Manager > Web Sites > Your web site's properties > HTTP Headers.
How
"HTTP 1.1 introduced a new class of headers, Cache-Control response headers, to give Web publishers more control over their content, and to address the limitations of Expires.
(...) max-age=[seconds] — specifies the maximum amount of time that an representation will be considered fresh. Similar to Expires, this directive is relative to the time of the request, rather than absolute. [seconds] is the number of seconds from the time of the request you wish the representation to be fresh for."
from Caching Tutorial for Web Authors and Webmasters.
More
Several properties can be set for the Cache-Control response header. Internet Explorer also implements additional extensions (post-check/pre-check and no-check). I usually set max-age to 3600 seconds (1 hour) and no-check.
To set the headers, open IIS, go to the web site's properties, HTTP Headers tab and add or edit a custom header.
E.g.
- For this header:
- cache-control: max-age=3600, no-check
- Add a new custom HTTP header with these properties:
- Custom header name: cache-control
- Custom header value: max-age=3600, no-check
BLOB cache also sets a maximum age for resources in libraries. With this technique, however, it is applied to the entire site.
More information on Cache-Control extensions can be found at Building High Performance HTML Pages, Internet Explorer's Cache-Control Extensions and Speed up your SharePoint site using cache-control.

Conclusion
Caching can greatly improve a web site's performance, but no amount of caching can save a bad performing application in the first place.
Be sure to customize the caching for your specific application, because if you don't use the proper values, you can even risk reducing the performance of your site (e.g. excessive disk usage/space or memory usage).
There are other alternatives you can explore. In custom web parts or controls that push a lot of data you can use .NET's cache classes and implement custom caching. There's also a CodePlex project called SharePoint Cache (which I haven't tried yet).