I just upgraded to the iPhone 5 and plan on selling my old iPhone 4. However, I want to make sure I don't keep any personal information (photos, emails, contacts) on the device. Since both iPhones are synced with iCloud, I'm not sure that I am safe to just start deleting stuff without those same changes being synced to the new device. What is the appropriate way to clean up the old iPhone to be ready to sell?
Open Settings > General > Reset and choose Erase All Content and Settings.
This will wipe all personal data off the device (including all apps) and when it restarts it will be at the beginning of the wizard to set up a new device.
This will not effect any other devices linked to the same iCloud account, it purely clears the current device.
iOS 7 Update
If you have Find My Phone enabled, disable this before performing the steps above otherwise the buyer will be contacting you to get your account to activate the phone. This can be achieved by switching the Find My iPhone option in Settings > iCloud.
I didn't test it but I guess the easiest way would be to loose the connection to iCloud and then just reset it completely.
But I don't know if this is enough to clean it completely or if it would still be possible to regain the information through any kind of tools.