Someone was concerned about the legality of leaving USA with a lot of money. Does CBP enforce that, and how? Seems they would have to already have an alert on the person's name, to catch them when TSA scans the passport. Not encouraging anyone to break the law, but it seems there isn't much effort to enforce it.
One way is by using currency-sniffing dogs who are trained to detect the odor of currency. They could deploy such dogs in international departure areas, and search passengers or their luggage if the dog alerts.
CBP acknowledges that they employ currency-sniffing dogs (near the bottom of the page), and reports on a case at a land border crossing where a dog detected undeclared currency, which was seized and the driver arrested.
Many countries have random spot checks in the departures area. I’ve already seen that in the UK boarding a flight to Las Vegas, for instance. They did ask everybody boarding but I don’t remember if they actually performed any searches, though. They probably base their decision to search on the reaction of the people.
Depending on the bills used, if a large number of bills are required, then this is usually quite visible during security scans (though it may depend on the material used for the bills). In countries or places where security scans are performed by the same people handling this kind of issue (e.g. for some weird reason Eurostar security scans in Paris are performed by French customs), they can easily inquire at this point or tip off the people in charge of that.
But of course, enforcement is necessarily spotty. Unless you search everyone, you will miss most of the money going through. The idea is to catch enough, and impose severe penalties on them to deter others, very similarly to other forms of enforcement.