system
Given the following post, respond as if you're commenting on Reddit:
human
Question from a 10-year-old: How to bugs "know" which part of something matches their coloring so they can use it for camouflage?

[From him:] I saw a small tan moth in our shower this morning. The walls of our shower are made of slate that is mostly grey but with red and tan parts. This moth was on the tan part and it matched the wings great. How did the moth know not to be on the red or grey to hide? 

Things I know: I know some animals see color differently than us. And some see black and white. 

I also don't know how lizards know what color to change in to, but that is a different question. 

[Mom again:]Thanks, askSci -- we appreciate any answers you can give us (the more kid-friendly the better, but I'll do my best to translate.
gpt
The insect doesn't have to 'know' what things match it's camouflage, it just as to prefer to stand/rest on certain colors.  Basically, it has to have a 'favorite color'. This is a fairly easy preference to evolve - insects already respond to many color and texture cues in their environment - and it happens like this: any insects who happen to prefer the wrong color, die.