How do people make patches for closed source software from outside its software company/devs?

You see this with some apps (I think ReVanced is a popular example?) and games occasionally, and I've never been clear on how they do it.