A list of resources for you to read up on this is below.
But: science isn't really self correcting. Someone has to step up and fight to correct it, every single time. Spend some time learning about this problem - as I have - and you will find the overriding attitude is one of despair. Science isn't self correcting, it's arguably self corrupting:
1. There's no incentive to pick fights with colleagues so it almost never happens
2. Even when someone does pick that fight the institutions go to ground and defend their people, so there's no outcome.
3. The first response of journals and universities on being informed of fraud is to turn around and tell the fraudster everything, so there's no way to keep fraud detection techniques secret.
4. And usually after that they ask the fraudster to submit a "correction" (i.e. higher quality fake). The idea that you should maybe NOT let a fraudster have a second try once caught, does not seem to occur to the brightest of sparks that run our scientific institutions. There are actually cases where this has happened and then the original complainants spotted that the newly submitted correction was also fraudulent.
How do these papers get spotted? Spend time on PubPeer. It's a site where people compare notes on dodgy papers and how they're being detected. Also read the blogs of people like Elizabeth Bik, Smut Clyde, read the old blog posts by Joe Hilgard when he was still in academia, follow https://twitter.com/steamtraen
tl;dr There's a range of techniques used for different fields, often by looking for re-used images or data across papers that shouldn't be re-using them, or by spotting internal inconsistencies in reported data tables.