During this process, you'll be uploading a backup to iCloud as well as performing a factory reset. Both of these processes use a significant amount of battery, and problems can occur if your device runs out during the factory reset. Connecting to a Wi-Fi network will allow you to back up your device without using any mobile data. You can back up and reset your device from the Settings app. This will reset the device to its factory status, removing all of your data. After the reset is finished, you'll be able to restore your data from your iCloud backup. You'll want to back up your device to iCloud before you reset it. This will allow you to quickly restore your data after resetting. You'll need to be signed in with the same account you intend to sign in with after resetting. This will allow you to download your iCloud backup to the reset device. If a different Apple ID is signed in, tap it and tap "Sign Out," then sign in with your Apple ID. This will open the iCloud Backup settings. This will enable the backup service. This will begin backing up your device. This may take a while, especially if you have a slower internet connection. You can monitor the progress below the "Back Up Now" button.  You'll be restoring this backup after performing the factory reset, which will erase all of the data on your iOS device. Note that content synced from iTunes, such as music and videos, will not be backed up and will need to be synced again after resetting. Content purchased from the iTunes Store or the App Store will be available to download again from the respective stores. After the back up is complete, you can start the reset process from the General menu. This will open the Reset menu. You'll be asked to enter your passcode to confirm that you want to proceed. If you have a Restrictions passcode, you'll need to enter it as well. All of the data on your iOS device will be deleted, but you'll be able to restore using your iCloud backup. Your device will restart and the reset process will begin. The reset process may take 20 minutes or so to complete. You'll see a progress bar underneath the Apple logo. After your device finishes resetting, you'll be taken through the setup process as if the device were brand new. During this process you'll sign in with your Apple ID and set your device's network and locations settings. During the setup process, you'll be given the option to restore your iOS device from a backup. Select "iCloud" to connect to iCloud and download the backup you created at the beginning of this method. Make sure you're signed in with the same Apple ID to access the backup. You can find all of your previous purchased and free apps in the App Store. Open it and tap the "Updates" tab, then tap "Purchased." You can then tap "Not on This Device" and then tap the download button for any app you want to download again.

Summary:
Connect your device to a power source and a Wi-Fi network. Open the Settings app. Select "iCloud." Make sure you're signed in with the correct Apple ID. Tap "Backup" in the iCloud menu. Toggle "iCloud Backup" on if it isn't. Tap "Back Up Now." Return to the Settings menu and select "General." Scroll to the bottom and select "Reset." Select "Erase All Content and Settings" and follow the prompts. Wait for your device to reset. Start the setup process. Choose to restore your backup from iCloud. Download your apps again from the App Store.