Trying to understand from any angle including ..
I'm not an expert on the process but from my understanding, they generally don't survive for hundreds of years. There are professionals that restore paintings so that can mean anything from removing grime to repainting a portion of the work.
If you're talking about oil painting, the main thing that keeps them surviving is the combination of the use of stable mineral pigments (other pigments, for example those based on vegetable extracts, have a tendency to fade, especially in reaction to direct sunlight, being what are called 'fugitive' pigments) and the varnish. Varnish is key, and in fact most picture restoration consists of a process of very carefully removing (with a combination of chemicals and very fine sharp tools) the varnish layer, which especially in older paintings which have been exposed to indoor environments with a lot of open fires, tobacco smoke and so on, tends to slowly discolour and absorb dirt over time. Another aspect of how a painting survives is the substrate on to which it is painted. Both wood and canvas decay over time, with a lot of factors affecting the rate at which they decay. Art restorers can extend the life of a painting on canvas by centuries by carefully backing the canvas with new modern materials. There also exist techniques to transfer paintings from damaged panels, but they are incredibly risky and rarely used nowadays. When possible, art restorers strive to do as little re-painting as possible, and there are generally strict protocols about how it should be done.