If you sell a computer as-is without formatting it or otherwise removing your data, not only can the buyer get your personal files, but with the proper know-how that user can uncover all the passwords stored on your keychain and be able to access your online services.
I have seen numerous instances where people have purchased systems off eBay and started them up to find the seller's data still on the drive with automatic log-in enabled so anyone can access it. I have also helped people who have bought used computers that are having problems with their system, to find a secondary user account on the machine (the old owner's) that the current owner was unaware of.
Without going into the obvious reasons why distributing your personal data to strangers is a bad idea, once your old Mac has served its purpose and you are ready to sell it, be sure you properly prepare it for sale. Here are some tips for preparing your system so you can rest easy that your old system does not contain anything confidential.
Back up the system
Be sure to back up your system before you start preparing it for sale, since the next steps involve erasing your data. I recommend you do this with Time Machine or a cloning utility such as Carbon Copy Cloner or SuperDuper (there are others as well). You can use this backup as a source for migrating to your new system, if needed.
This is a step that even seasoned computer geeks will often overlook. Many online services require you to authorize the systems you use with their service (Apple's iTunes service does this, and there may be others as well). Go through your system and de-authorize it from within the program, since even if you format the computer and remove these programs, the online service will still assume you have one system authorized. There are ways around this, but they're cumbersome and require going to each service and resetting the authorized systems (at times you may need to call them).
Not only might there be software-based authorization services, but others may identify your system through hardware. One example is MAC filtering in routers, where only that system will be granted network access. During the transition to the new system, be aware of any hardware-based filtering or authentication you use and disable or change it accordingly.
This is perhaps unnecessary, but while we're clearing out all user data and setting the system up from scratch we might as well clear any user-modifiable hardware settings. You can do this immediately before erasing the drive and optionally reinstalling the OS, so the system will be as fresh as possible upon first booting into the newly installed OS.
To do this, at this point insert your OS X installation DVD (preferably the one you are going to include with the system when you sell it). Then reset the SMC on the system according to the instructions in this Knowledgebase Article, and then power up the system and immediately clear the PRAM by restarting the system and holding down the Option-Command-P-R keys all at once, allowing the system to reset several times before releasing the keys.
When you release the keys, so that the system boots normally, immediately hold down the "C" key so the system boots to the OS installation DVD instead of the boot drive.
Partition and format the drive
Many people might think quickly erasing the drive and running an OS reinstall will be enough to secure their data, but without performing a full format that at the very least zeros out the data on disk, you chance leaving data that can be recovered by numerous file recovery programs.
Once you are booted to the OS X installation DVD, choose your language, and then open Disk Utility from the "Utilities" menu. From here, both repartition and format the drive to set the drive up completely from scratch.
Select the boot drive device from the list to the left (the item right above Macintosh HD) and choose the "Partition" tab. Select "1 Partition" from the Volume Scheme menu, and choose GUID as the partition scheme upon clicking the Options button. This will ensure the disk will be most compatible with your Mac (if you are using an older PowerPC Mac, choose the "Apple Partition Map" option).
Once the partition is ready click "Apply" to set up the new volume scheme. You do not need to set a volume format at this time but can if you want.
Now go to the "Erase" tab and choose the format to use (Mac OS Extended should be fine). In the "Security Options" button at least choose the option to zero out all data on the disk, but for added (and perhaps redundantly unnecessary) security you can choose a 7-pass or 35-pass erase. These ensure the residual data on the drive can never be recovered, but will take a long time to complete (hours if not days, depending on the volume size and erase scheme used).
Repeat this process for all drives in the system.
Reinstall the OS
Once the volume is formatted so no data can be retrieved, you might consider including OS X for the new owner, but you do not have to. I believe you are required to include the gray OS installation and recovery discs with the system upon selling it, but you do not need to spend the time installing the OS.
If you do not plan on reinstalling the OS, after formatting the drives in the system just shut the system down, and pack in the OS X installation DVD with the computer when you ship it.
If you plan on installing OS X, one option I recommend is to set it up so the new user will see the same Welcome screen that displays whenever a new computer is purchased. To do this, proceed with the installation of OS X and follow the onscreen instructions up to the point where it asks you to enter a username and password to create your first account. At this screen press Command-Q to quit the installer and shut down the system. The next time the system is powered on it will display the same welcome message and be ready to install OS X.