Yes, a factory WILL remove anything on the phone that you’ve added to it.
There’s a few different ways of doing this but I prefer the Google way myself since it takes very little effort.
This is done on a HTC One M8 with 6.0 and Sense 7, and might not look the same way on all phones. But, it looks very similar on all HTC phones that got full HTC Sense software.
The Google Way
For this to fully work you need to have Auto-sync turned ON under Settings > Accounts & Sync. That is the default setting that you shouldn’t change.
And this of course requires you to know and remember your Google account and password.
Make sure that you save new contacts as Google contacts, under “contact type” you simply select Google. The contacts will then be synced with your online storage for this, this also allow for you to look at and edit your contacts online.
If you already saved contacts as phone contacts you don’t have to worry as there is of course a way to copy them to your Google account.
People > 3 dot menu > Manage contacts > Copy contacts
Where it will ask where to copy contacts from, and then where to copy contacts to. So, from phone and then to Google. That’s pretty much it. It will then sync your contacts to your Google online storage. If you want to edit them online, go HERE.
Then after you factory reset your phone, after you’ve added back your Google account and it syncs a bit. Then the contacts are back. I know. Magic!
The Export way
You simply export contacts to SD card which will keep them safe. You can even take that export file and save it somewhere else. Just don’t lose that file as it all depends on it.
People > 3 dot menu > Manage contacts > Import/Export contacts
Where you select Export to SD card, it will then ask an account to export. In this case you select Phone.
Then it will ask for you to turn on password for the export, my recommendation is to not do that as it can complicate things if you don’t remember that password. Yes, I’ve seen that. So, just tap NO.
Then it want you to confirm export by simply tapping OK.
Then when you want it back you just do it in reverse and select Import from SD card instead. Where it will ask for what account they will be imported to. My recommendation is of course Google since then you would never have to do this again.