The following steps are intended for the HTC One M7 running any Android software.
Tap the All Apps icon.
Tap Settings.
Tap Backup & Reset.
Tap Reset Phone.
Tap OK.
Tap No Thanks.
(If you have recently did a backup on your device)
Tap OK.
Once the phone has powered back on, you will need to set it up for the first time.