Please download and install IUWEshare Digital Camera Photo Recovery(Win/Mac) on your computer at first.
Common scenarios of losing photos from Nikon D5100 are:
IUWEshare Digital Camera Photo Recovery(Win/Mac) is a reliable tool that enables you to restore deleted photos from Nikon D5100 digital camera and also from various other brands of digital camera like Canon, Kodak, Nikon coolpix, Panasonic etc. It can recover deleted JPEG and NEF photos from Nikon D5100 SD/SDHC/SDXC memory Card fast, easy and reliable.
Remove the SD card from the camera and connect the card to the computer with a card reader.
Select the icons that represents your Nikon memory card as the storage media to scan. Then hit "Scan" button to continue.
After the scan, all the recoverable files will be listed in the left panel. You can preview them in the right panel by thumbnails or lists. Select the ones you want to recover and hit "Recover" button to save them to your specified folder.