How science corrects itself. Phlogiston, luminiferous aether, steady state cosmology, continental drift rejected for fifty years, stomach ulcers as stress before H. pylori.
Then the modern machinery: peer review and its failures, the replication crisis, publication bias, retraction.