Yes it is an art you must master in photography. It is a constant battle to keep your equipment free from scratches, dust, and other micro debris ending up in your final image. Even in a studio, where you have some control over the environment, it is still a constant struggle. Think of how it is dragging your equipment through the Amazon forest.
I will not enter into the obvious like keeping your lens covers on and protecting your gear in transport etc. But here are two ways to handle scratches, before and after it happens, that I use a lot.
I always take care of my equipment all the way until I actually shoot. Then it is a matter of getting the shots I want. That usually means dragging the camera through wrecks underwater, into cracks in caves or hanging in ropes in the forest. And that is when shit happens. I usually come back from diving with some sort of scratches or other marks. Sometimes I am unlucky and get scratches on the dome port of the underwater housing. If the scratch is deep or sharp it will reflect and show on the pictures. Sometimes it is bad and I have to replace the port but usually I can fix it before next dive. Now that the domes are not glass but acrylic, they have made a magic product. It is a white paste you can smear into the scratches and polish back to clear acrylic. It fills the small cracks and usually solves the problem. They come in different thickness and you are supposed to use the thicker on bigger cracks. I bring this on every dive trip and it has saved me more than once. This product is only ment for acrylic surfaces, not for your actual lens. But it can be used for the ports of underwater housings, go pro housings or acrylic windows in vehicles you want to photograph through etc.
But sometimes it is to bad and you get scratch or damage on your image anyway, then you have to fix it in post. I then just go into Photoshop and use these simple steps. I have made it easy for you with a big visible line in a photo and taken screenshots from the Photoshop process. Good luck.