There are two ways (I've never used a d500, but this should be true)
Either find an option to "Format SD Card" which will erase absolutely everything on the card (obviously make sure anything of value is moved to a safe place)
Or, when go to playback mode, and view one of the images that can't be deleted. Now find a button on your camera marked "AE-L/AF-L" and press it. You should see a key symbol appear or dissappear if you press the button a few times. When it's not visible, the image can be deleted normally. If the key is present, it prevents the image from being deleted. Go to each image and press the AE-L/AF-L button to remove the key, and you're sorted.
Luke said...'Now find a button on your camera marked "AE-L/AF-L" and press it'......and it worked perfectly! There was a box in the corner of each image but I was too quick deleting them
Thanks also 'Terry' that would have been my got to problem solver.
I use that button to back button focus, and very often i'm reviewing images on playback and spot a bird (or anything) and quickly put the camera to my face and push the focus button, wondering why nothing is happening. Usually, after an embarrassing amount of time and the photo opportunity being missed, I realise I've just been toggling an image between "protected" and unlocked eventually I'll learn!