Factory reset an iPhone/iPad using Settings > General > Reset > Erase all content and settings. You will be prompted to enter the passcode and Apple ID before the process completes.
How to soft reset an iPhone/iPad
If the iPhone/iPad has locked up and you just want to restart it but none of the buttons work, then hold the power button and home button down at the same time until the device turns off and you see the Apple logo. Then let go and the iPhone/iPad will be back to normal. If you don't have a home button, Use the Volume+ button.
Back up before you reset
Even if you use iCloud before you do so it's sensible to make a full backup by connecting the iPhone/iPad to the computer, unlocking it, waiting for it to show up in iTunes, and then clicking on it in the left-hand pane. It should open the Summary screen, where you'll see a Backups section. Simply click the Back Up Now button. (Check the Encrypt iPhone/iPad backup box if you want all the passwords to be saved.)
Once that's done, you can begin the reset process.
The version of iOS the device are using may affect what you see here, but all are roughly the same - and things look the same on an iPhone/iPad.
Step 1. Tap Settings, then General. Scroll down until you see Reset.
Step 2. Tap Erase All Content and Settings. Depending on whether the device have a set of Passcode and/or a Restrictions Passcode (they are different) you might have to enter that code or password in order to erase and reset it. There is no way to reset the device unless you enter the code(s).
Step 3. Now you will have to enter the Apple ID password. This is so the account can be removed from the device, and Find My iPhone/iPad can be switched off. If you merely restore an iPhone/iPad via iTunes, you'll be asked to enter the Apple ID and password when it reboots. Resetting it using the method we're describing here will prevent the iPhone/iPad asking for an Apple ID when it restarts.