backup the device and restore it as new.
If you already have or don't need a backup:
Erase your device
Erasing all content and settings will delete all the data from your device, including songs, videos, contacts, photos, calendar information, and any other data. All device settings are restored to their factory condition.
To remove all settings and information from your device, tap Settings > General > Reset > Erase All Content and Settings. For more information about this feature, see iOS: Understanding 'Erase All Content and Settings'.
If you are unable to erase your device, restore the device using iTunes.
See: http://support.apple.com/kb/HT4137 for the exact steps.
Transferring ringtones isn't supported, as far as I know...