They learn this in the first day or two of life.For example, imagine a mother duck in a lake. Four or five small ducklings are swimming after her. They know to follow her. Ducklings quickly imprint on the first moving thing that they see. Usually this is their mother, but not always.