"How do they know what the dog smelled? "
They can't know. In court they just say that the dog alerted on something, and the court probably will accept that as probable cause.
Once you are in court, you will have a hard time bringing up the dog's training. If it's trained to alert when the handler says a keyword or makes a hand sign, you could get your case thrown out due to lack of probable cause- big maybe, and you won't get the opportunity to even bring that up.
In Federal court, the defense can't bring up anything that the prosecution does not bring up first.
besides, at that point, if you are in court, the cops found something indictable on you and whining about probable cause will merely irritate everyone. This guy had undeclared cash, and that's a problem.
What we have here is a terrorist coming into the country with a big rubber stamp on his forehead that says "Arrest me or I keel you, you evil children of the Great Satan!" And because of the frickin' politically correct hell we are saddled with, instead of just pulling the guy aside and searching them, they have to do it under the guise of breaking a law.
The old "whack!.... Uh, sir, I pulled you over because your tail light is out, but since your being so cooperative with me today, do you mind if I just take a quick look through your trunk?"