Lurker, if you really want to look into it, go read the links provided by VM, as well as mine, then go read the story of a horse named Clever Hans.
At the end of the day, animals are very perceptive and attuned to their handlers, and will do their best to give what they think their handlers want. They have great noses, and can smell all kinds of things, but they also pick up on all sorts of subtle cues--including unintended cues--and react accordingly. If an officer indicates that he expects the dog to alert--whether deliberately or, as in the case of Clever Hans, completely subconsciously, with no fraudulent intent--the dog will pick up on that and deliver accordingly.
At the end of the day, animals are very perceptive and attuned to their handlers, and will do their best to give what they think their handlers want. They have great noses, and can smell all kinds of things, but they also pick up on all sorts of subtle cues--including unintended cues--and react accordingly. If an officer indicates that he expects the dog to alert--whether deliberately or, as in the case of Clever Hans, completely subconsciously, with no fraudulent intent--the dog will pick up on that and deliver accordingly.