The easiest way to perform a Factory Reset on your Samsung Galaxy S4 is from within the menu settings:
Settings > Accounts > Back Up and Reset > Factory Data Reset > Reset Device > Delete All/Erase Everything.
Please remember to back up any data you want to keep first! In the Factory reset screen you also have the option to Backup My Data and Auto Restore. These are good options to tick before you Factory Reset if you're not too sure how to do this on your own.
If you're at all paranoid about your SIM card or SD card contents just take them out before you do the Factory Reset. Attention: if you reset your device to the factory default with SD card encryption setting enabled, the device will not be able to read your encrypted files. Disable this setting before resetting the device.
Alternatively, you can type in *2767*3855# on the key pad and that will do the same thing.
Remember sometimes you don't need to go even this far to solve problems. First of all try just turning your phone off for a while, or removing the battery entirely. Sometimes something as simple as that is enough to clear up some simple problems.
But if you've tried all of these methods and are still having problems, you can try a Hard Reset, the instructions for which are here.
I have restored the factory settings on my samsung s4.
I have now lost all my sim contacts.
I foolishly have not backed them up (I think).
Is there any way I can restore just my contact list???