Comprehension
Based on molecular evidence, we know life evolved from one common ancestor around three billion years ago. From then, evolution progressed, slowly to begin with - in the last billion years, we see very rapid diversification of life forms on Earth as multiple components clicked into place, including multicellularity or multiple cells coming together to form one organism, etc. Against this backdrop, we find all insects share a relationship with each other - they have a certain body plan, cellular functions, genetically encoded features (many have six legs, for instance) and the information of how these features are formed encoded in their genome. Butterflies share many evolutionary features with insects.
Butterflies are also specialised moths, the two separating from their sister group of insects 150 to 200 million years ago. Thereafter, moths themselves evolved significantly before butterflies emerged as a separate group about 85 million years ago, around when dinosaurs went extinct. All the characteristics butterflies have-including much more acute vision compared to moths who rely more on smell - grew thereon. Visual cues are extremely important for butterflies which explains why many are so attractive. Their appealing colours evolved to help them either evade predators or attract mates, dark colours developing to help butterflies maintain body temperature, being cold-blooded.
Some species developed fascinating traits. Aposematism is a combination of two features - one is a defence against predators, like a chemical cover, some butterflies being toxic to birds, spiders, etc. These caterpillars feed on toxic plants which are difficult, if not deadly, for predators to digest. Being protected thus is an internal property - but butterflies with toxins then developed bright wing patterns to show predators they are dangerous, signalling the risk they bear.
Butterflies and Insects separated