Throw away any files which may contain sensitive data and securely empty the Trash.
If it shipped with Mac OS X 10.6.8 or earlier, insert its original disk and restart the computer with the C key held down.
If it shipped with Mac OS X 10.7 or newer, restart with the Command and R keys held down.
Use the Disk Utility to erase the partition with Mac OS X installed, and then install a new OS onto it. If you used a disk and are going to sell or give away the computer, include the disk with it.