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?
Apple has documented the steps required in a support article.
If you have Find My Phone enabled, disable this 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.
Then en 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.