Have you ever noticed that your dog produces a noise when they open and close their teeth quickly in sequences, making a noise that humans make when they are cold? Teeth chattering is usually a quick noise that happens when you dog becomes excited, or perhaps when they are sniffing a particular spot.
Dogs have 300 million scent receptors in comparison to homosapien's mere 5 million scent receptors. In addition to such a powerful nose, dogs also have what's known as the "vomeronasal organ" also known as the Jacobson’s Organ. This organ is located at the roof of the dog's mouth. The main function of organ is to send pheromones, which dogs leave behind as an act of communication. The organ is able to receive this information and relay messages to the brain regarding the pheromones. For example, when a dog is exposed to the urine of an animal in heat, a male will typically throw back his head and raise or curl his upper lip - this allows the Jacobson's Organ to open entirely in order for the dog to fully inspect the scent.
Dogs also have a duct known as the "incisive papilla" which happens to be located behind the dog's top incisor teeth. This duct connects their nose with the mouth allowing them to carefully analyze and even taste what they are sniffing. When this happens you will most likely notice your dog begin to chatter their teeth, sending huge molecules towards his incisive papilla (with the help of the tongue). When those molecules reach the dog's brain they will then make a decision based on the findings. Perhaps your dog will mark their spot or perhaps he will ignore his recall training because of his concentration.
Teeth chattering can also be from a dog:
smelling an intact male, a female dog in heat or an injury;
waiting in extreme anticipation;
suffering from anxiety or neurological issues (you will notice excessive chattering, and with that a vet visit is needed).
This phenomenon is not to get confused with air snapping - a behavior seen in dogs when they open and close their mouth as if they are biting the air in front of them. Air snapping is usually a warning sign before a potential bite. This phenomenon should also not be confused with teeth clacking - noises when dogs are playing side-by-side and engage in a lazy game of "jaw sparring".