How does mass surveillance works?

I understand that it is a complex problem. Dear @reC I do not mean anonymity in the Mathematical sense. This can’t be done. As you write there is a self reffering problem. I wanted to understand the basics of how these “special” equipment work. It was written that they patch the equipment of ISPs for example. However, it is well known that even individuals, not belonging to the public sector, usually rich people have such equipment. Obviously those can not patch ISP’s equipment. So there is a kind of surveillance that works independently of the ISPs.