- Open “Settings”
- Tap “General”
- Scroll to “Reset” and tap it
- A list of possible actions will be shown, as illustrated in the figure below
- To return the device to its original factory condition, tap “Erase All Content and Settings”

The process goes pretty quickly and then you will have a clean system with all your personal data and apps removed, including your Apple ID. Next time the device is turned on it will go through a first-time setup just as if it were new.
How to Erase All Your Personal Content from an iPhone or iPad