The majority of folk tales involve danger faced by the main character. Stories like “Little Red Riding Hood” involve dangerous situations that the characters have to get out of.
One theory, studied by C. S Lewis, author of "Chronicles of Narnia" suggests that fairy tales present courage to their readers by meeting cruel enemies. According to him, fairly tales helped children battle pains and frustrations of reality, in a metaphorical way.
Fairy stories may teach us about the horrors and dangers of the adult world but they can also give us comfort that everything ends in a good way.