Once upon a time I lived in a friend’s goat milking shed. The goat pen was attached.
Each morning a herd of deer would wander by and the goats and the deer would stand silently looking at each other for upwards of a minute, after which the deer would wander off on their daily rounds.
One morning the deer came up as usual, but after a short while the goats lined up in pecking order (or whatever you call goat hierarchy) and single file jumped over the fence.
When the last (Fran, the trainer goat) joined them they ran off thoroughly mixed as a single herd. It was amusing to see the variegated coats of the goats mixed in with the uniform tawny deer.
The goats returned when it was time to be milked, but without their deer cousins.
I conjecture that the forage was especially good that day and the goats were able to smell it on the exhalations of the deer.