In that process, after clearing customs the truck moves to something called an “I house”, an inspection house. The inspection house is usually not right at the border. It's usually not far from the border, but nearby. These are privately owned, but they have USDA inspectors at them.
When the truck arrives at that I house, it will be told what kind of inspection is necessary. Sometimes they might just open it up, look at the manifest, and see that the boxes in the truck are the same as what's on the manifest. Sometimes they might open the boxes and start taking samples to be sent away for tests.
Let's say a company such as Cargill is going to export meat to the United States. If one of their trucks is opened up and the inspectors take samples, Cargill will immediately return that truck to Canada, because either way, whatever the test result is.... If it proves that it's okay, they have probably lost several days of shelf life on the product; if it proceeds and the test ends up turning negative, because there was some issue with it, then they have a recall on their hands.
They can figure that usually about one in ten loads is going to have a test. If they have a customer who is ordering 10 loads, they ship 11, because they know one of them is coming back.