Snakes, as well as lizards, use smell to track their prey. They smell by using their forked tongues to collect airborne particles, then passing them to the vomeronasal organ or Jacobson's organ in the mouth for examination.The fork in the tongue gives snakes a sort of directional sense of smell and taste simultaneously. They keep their tongues constantly in motion, sampling particles from the air, ground, and water analyzing the chemicals found, and determining the presence of prey or predators in the local environment. In water-dwelling snakes, such as the anaconda, the tongue functions efficiently underwater.

More Info: en.wikipedia.org