Reset to Factory Settings (When your phone can be turned on)
Settings ->System ->Reset Options ->Erase all data (factory reset)
Reset to Factory Settings (When your phone cannot be turned on)
Power off your phone -> Press and hold the Power and Volume up buttons -> After your phone vibrates, keep holding the buttons for 5 seconds to enter Recovery mode -> Press the Volume up and down buttons to select the option to clear data or restore your device to its factory settings -> then press the Power button to confirm -> Reboot your phone.