Here is how the process works:
The original photograph is scanned, so that it can be processed as a digital file on the computer. Using specialized software, the blemishes or even extensive damages in the picture can be repaired.
This is sometimes a very slow and laborious operation that requires experience and some artistic finesse, especially when parts of the image are totally destroyed. The computer software does not automatically solve the problems, it is just a tool.
The final result can then be printed again, or just used in digital form.