How I find these bugs
Most of these fixes come from reading library code for a small set of failure patterns that tests rarely cover: blocking calls such as time.sleep or requests.get inside async functions, file handles and pooled connections that leak when an exception is raised, and mutable state shared across instances or connections that should be separate.
More recently I compare libraries against a reference implementation with the same API, such as JAX and dask against NumPy and SciPy, or pyfakefs against the real operating system, and look for inputs where the two disagree. Empty and zero-size inputs turn up a surprising number of crashes.
Before opening a pull request I reproduce the bug, write a test that fails without the fix, and keep the change as small as the maintainers would want it.