How have the moths managed to become so well camouflaged? The reason can be seen in the display: The predator takes those prey that are easiest to detect. Those that are best at fooling the predator survive. Such traits are passed on to the next generation. That's why there are so many prey animals that are good at escaping.
The predator's hunt thus results in the selection and gradual disappearance of individuals with certain traits. Those with other traits survive and increase their numbers. As you can see, that process occurs spontaneously. It is called "natural selection".
After many generations, the moths' have become well adapted to their environment. In this case, it includes the presence of a predator and the colour of the bark they are resting upon.
This entire chain of events – the natural selection of certain inherited traits, which results in effective adaptation – is called "evolution".