|I'll pounce on the feather. You wrestle the fish, and when|
no one is looking, we'll both attack the string, which will
make the bowling ball fall down on the bad guy's head...
Children in stories can be the protagonists. They can also be foils, background characters, plot devices, or comic relief. What roles they play frequently has to do with the target age of the reader--but not always, as plenty of adult books cast children as viewpoint characters, sometimes as the only ones, and sometimes as one of many.
Why might adult fiction have a viewpoint from a child? In some cases, it's to create a foil with innocence: what better way to contrast your main character's jaded side than with a young person? Children also lack the societal constraints adults deal with, which means they can do things adult characters can't, such as interrupt a tense scene, or even admit to their vulnerabilities ("I'm scared!") and give voice to the feelings adults cannot.
I often see the latter used as a way to enhance an adult's strengths. A child admitting fear stirs adult protective instincts, and make an adult less likely to back down, or acknowledge their own insecurities. This can be a good thing when the protagonist is plagued by self-doubts, and needs a push to gain the confidence to do what needs to be done. Children's fears also help alpha-type characters, who often do not or even cannot express their own emotions in most circumstances, admit that they, too, are afraid. It makes your strong characters more realistic, by giving them weaknesses. At the same time, offering comfort to another makes them stronger, and shows the protective, caring nature of a good guy.
As a contrast, someone who doesn't take the time to reassure children is reinforced as a villain. While heroes can be insecure around kids (which is a frequent humor device), they'll at least make the effort to comfort and protect them. An evil villain, on the other hand, will simply not care if a kid is happy or crying, or will be angry that the child's crying is interrupting things. As an alternative, a likable villain might care about the children, and try to spare them as much as possible, or make an effort to keep them safe. This also works for antiheroes, and can give depth to any 2D bad guy by giving them a good side.
But kids, when confronted by the villain, may be at an advantage for the simple expedient of creativity. Kids as characters give writers leeway to do things that would be borderline impossible, simply because children have no limits in creativity. What a full-grown character can't do, because the sheer amount of luck that would be needed to pull it off? It's far more believable if a child makes it happen. Kids can also find solutions to puzzles adults can't figure out, by stating the obvious, or by doing something so off-the-wall it might just work. By writing the scene from the child's viewpoint, the author can describe the logic behind it, making the most insane idea seem perfectly sound.
Are there children in your favorite stories? What do they add to the stories?