system
Given the following post, respond as if you're commenting on Reddit:
human
How do animals know to avoid eating poisonous animals?

I know that animals have been known to associate colorful animals as being poisonous but how did this come about? I would find it hard to believe that the animals would be able to figure out that the colorful frog or whatever is what caused them to be sick or die and then also be able to pass this information onto other members of their species.
gpt
Consider two birds, one which will happily eat any color of frog, and another which has some strange aversion to red frogs for some unknown reason. He doesn't avoid red frogs because he knows they're dangerous, or for any other rational reason, he just doesn't like them. We'll assume that these preferences are hereditary, meaning that they can be passed on to offspring.

Each bird sees a red frog. The bird which eats any color eats the frog and dies. He won't reproduce, so he doesn't have any offspring to "teach" not to eat red frogs. He did his part by dying. The bird which really dislikes the color red doesn't eat the frog, and doesn't die. He then goes on to reproduce, and make more birds which won't eat red frogs.

Aaand that's evolution. It of course gets much more complicated than that, but to start things off, all you need are 1. a population with some variety, where these variable traits are hereditary, and 2. selection pressure which makes one trait more beneficial than another.