How do animals recognise their babies just by smelling them?
The same way my dog tracked me from our house through sidewalks thronged with tourists to a place he’d never known me to go.
We all have our own unique smell. Other mammals have retained their conscious awareness of smells better than we have, and many animals — like dogs, for instance — have a far superior sense of smell than humans.
Imagine a smell that brings back a strong memory or a strong feeling, or even better, when passing a stranger you smell their perfume and it suddenly reminds you of a dear friend. This is the result of a past event where you encountered the smell and it left an imprint. You associate the smell with those things. Specific smells are inducing associative memories. The smell of bread makes you hungry because your brain was conditioned to the particular smell.
When a baby (animal or human) is born the mother instinct is very strong and the smells and sounds induce a strong emotional reaction which you are now connected within your memory (several parts of the brain are involved but the olfactory bulb would be my primary guess). This is observed in animals because it is still actively used to distinguish between your own and other’s kids, humans need this skill to a far lesser extent so we don’t really train or observe it.