Sense of smell is critical in the life of many animals and serves to find food and mates as well as avoid predators and toxins. For humans, it can indicate a brain disorder or enhance quality of life.
Sensory perception is an active process. Active sensing means the environment is sampled and then attention drawn to the important target. Just as rapid eye movement precedes fixation on a certain spot, sniffing the area enables selection of an air-borne plume or surface-borne trail.
Further details: On the track of mouse sniffing behaviour