Molecules, such as enzymes, saddle themselves to other molecules with a corresponding pattern of physical characteristics - nothing personal, just physics acting out its laws. Animal patterns work much the same way. Hard coded into the minuscule nervous center of a fly, wasp or spider is recognition of their own pattern on others. This is not something conscious but prescribed and automatic, much as bonding molecules nestle their intricate array of attractive and repulsive charges and gain a new nature.