There are several solutions to this, depending on the exact nature of the problem.
If there are many broken links which can be solved in a straightforward manner, by substituting part of the original link, staff has a tool for this. You might have seen it in action when many http:// links to other Stack Exchange internal resources were replaced with https://; another recent example is Links to HTML versions of RFC's need to move from "tools" to "datatracker". The advantage of this is that the edits are fully automated and do not bump posts; we don't want hundreds of old questions ending up on the front page at once, reducing the visibility of new, more relevant questions.
If that is not feasible, and we need Wayback Machine copies of resources that are no longer available, I have written a script that originally fixed broken images but has been successful for other mass-link-repair-operations across the network. You can see some of the results on Super User by visiting my edit history. The script throttles the number of edits to avoid flooding the front page too much (even more when it relies on other users approving my suggested edits).
The script does require some sort of selection; just checking all posts would take too long and bump too many posts. I usually run it only when I know some kind of links are often used (e.g. Homebrew and ImageMagick). I spotted those after reviewing suggested edits fixing one instance of those links (sorry, I don't remember who found them); feel free to reply here if you know of other candidate links. And those instances could have been solved by staff without the bump, but I did not know of that tool back then.
Anyway, it's a good reminder that answers should never rely completely on external links.
:-)). It is not like you can expect from whoever posted a response to keep the links in order after years. It should be a duty of the site managers. It could become a script-assisted queue review.