Losing contacts on your iPhone isn't a catastrophe, provided you have a back up (either iTunes or iCloud). Restoring a backup can take an hour or more and requires that you delete everything from your iPhone.
Restoring from iTunes can be complicated if you also sync your contacts with iCloud (not the same as an iCloud backup). Syncing happens every few seconds, so you need to temporarily disable iCloud -- otherwise, iCloud will delete your contacts before you even see them.
Restoring Contacts from ITunes
Locate your iTunes backup. In Windows 8.1, this is located in the "\Users(username)\AppData\Roaming\Apple Computer\MobileSync\Backup" file. To find it quickly, click the "Search" icon on the Windows Start screen, type "%appdata%" and press Return. Right-click to copy the file, then right-click inside the same folder and paste to create an emergency copy.
Start iTunes and make sure it's updated to the latest version. Connect the iPhone to your computer. Select "Devices" from the File menu and select "Back Up." If you don't see the File menu, press "Ctrl-B" to reveal it with the Menu Bar.
If you use iCloud to back up your contacts, go to My Apple ID. Click "Manage Your Apple ID," then sign in and change your password.This stops iCloud from syncing and erasing your contacts anywhere else, so don't update your new password on your iPhone yet.
Click the iTunes "File" menu, select "Devices," and click "Restore from Back up." Follow the onscreen instructions to delete everything on your iPhone and restore it from your old backup -- the one you made before your contacts were deleted. Disconnect the iPhone from your computer when the data restoration is complete. Launch the iPhone's "Contacts" app. Your missing contacts should be right where you left them. If you don't use iCloud, you're all done.
If you use iCloud to sync contacts, tap "Settings." Select "iCloud" and tap "Delete Account." When prompted, select "Keep on My iPhone" so your data isn't deleted.
If you sync iCloud to your computer contacts, create a new user account on your computer Start the iCloud Control Panel and sign out of your iCloud account.
Log out of your Windows user account and log in again with the new account. Start iTunes, connect your iPhone to the computer and select the iPhone when it appears. Click the iTunes "Info" tab and select "Sync contacts with Outlook" -- or whichever email client you use. Click the "Sync" button.
Start the iCloud Control Panel and sign in with your new Apple ID password. Select the "Contacts" check box to upload your intact contacts to iCloud. When prompted, select the option to merge your data with your iCloud account. Log in to iCloud.com when the process is finished. Your deleted contacts should be back in iCloud.
Sign out of the iCloud control panel. Log out of Windows and log back in with your primary Windows account. Log in to the iCloud Control Panel again, select "Contacts" and merge them once again. Your contacts on iCloud and on your computer should now all be intact.
Launch "Settings" on the iPhone, select "iCloud," and sign in with your new Apple ID password. Make sure the "Contacts" option is turned on. That's it. Your missing contacts should be back on your iPhone, your computer and in iCloud without the risk of being automatically deleted again.
Restoring from an iCloud Backup
Start Settings on the iPhone. Scroll down and select "iCloud." Scroll down again and tap "Storage and Backup."
Scroll to the bottom of the Storage and Backup screen. Look at the date and time of the last backup. If the last backup was done before your contacts disappeared on the iPhone, you can recover them.
Tap the "iCloud" and "Settings" back buttons and select "General." Scroll down and select "Reset." Choose "Erase All Contents and Settings." Enter your passcode if prompted and confirm your decision by tapping the "Erase iPhone" button. When the iPhone restarts, follow the onscreen prompts to restore the iPhone from your last iCloud backup.
If you've only deleted one or two contacts and have them on your computer, it's a lot easier to restore them to your iPhone manually. Disconnect your Wi-Fi router, turn on your computer and open your email client. You can then print the contacts, or take a screenshot, and then manually type the contacts back into your iPhone Contacts app.