Windows Vista will include a new Disk Defragmenter tool that will automatically defragment your hard disk—causing fragmented files to be rearranged on the disk more efficiently, thereby increasing the system's overall performance—but today's OSs are at a loss. Windows XP and previous Windows versions include a Disk Defragmenter that you can run only manually, and Mac OS X doesn't even include a bare-bones tool. But that shouldn't stop you from defragging your disk regularly.
In Windows, you can trigger Disk Defragmenter manually, of course, or use Task Scheduler to set up a scheduled defrag. But you can also use add-ons such as Microsoft's excellent Windows Live OneCare service, which triggers automatic disk defrags on a regular basis (and performs a bunch of other PC-protection tasks, as well). Because disk defragmentation is an intensive operation, it's best to let it happen late at night when no one will be using the PC.
On the Mac, you need to look a bit harder to find a good defrag tool. And don't fall into the trap of believing the rumors: Hard disks running under Mac OS X do indeed need to be defragged on a regular basis, just like any other OS. If anything, OS X is more prone to disk fragmentation than other OSs, although it does handle file fragmentation automatically. One option is Coriolis iDefrag. It's $30, but you can try the free demo version before purchasing. Note, however, that iDefrag doesn't yet support Intel-based Macs. So, users of such Macs will need a tool that comes in Universal Binary format, such as Intech's SpeedTools Utilities, which includes Disk Defrag. SpeedTools is a bit expensive, however, at $89.95.