If you set a firmware password, remove it by running Firmware Password Utility in Recovery mode.
If you activated FileVault in OS X 10.7 or later, turn it off.
If you use Boot Camp, the partition must be deleted
If you created any other data partitions on the internal drive, remove them in Disk Utility.
Erase the data partition(s) with the option to zero out data. An SSD doesn't need to be zeroed.
You can't legally or practically transfer any software downloaded from the Mac App Store to the new owner of the machine, even if it was free. That includes OS X, so if you upgraded to OS X 10.7 or later, you must reinstall the original OS, either from the installation media, if applicable, or by booting into Internet Recovery (option-command-R at the startup chime.) If you installed from discs or a read-only USB key, deliver those to the new owner.
The new owner will have to repurchase the software, if need be, under his or her Apple ID. If you ever updated the bundled iLife applications (Garage Band, iMovie, and iPhoto) through the App Store, you can't transfer them either.
Remove the machine from your list of registered products. If it's still covered by an AppleCare Protection Plan, transfer the coverage to the new owner by following the instructions in the AppleCare Terms and Conditions (under the heading "Transfer of Plan.")