picture courtesy of Taylor Schlades on morguefile.com
There's no magic answer to how many characters you should have in your story, especially if you are writing a novel. But overwhelming readers with the number of characters in a story is not good.
Sometimes the author shares a list of who is in the room--almost like calling roll in a classroom. Does a kid in a classroom care equally about everyone in the room? No. Neither does a reader.
Older students who have different classmates in every class may not even know all their names. They may think of someone as the tall girl or the annoying guy. It's okay to have nameless walk-on characters in a novel, too.
Sometimes when reading, I can't keep straight who is who in the cast of characters, which means there are not enough identifying characteristics of these people for me to keep them straight in my head. Or sometimes, it's too long between when they were last mentioned and I've forgotten who they are.
So what's a writer to do?
First, know every character in your story. If you don't know anything about someone besides his/her name and possibly gender, how can the reader? What does your main character, usually your viewpoint character, think of this person? Is he a help or hindrance to the main character? Is she a friend or acquaintance or chance met person? Is he important to the plot? How does she change or influence the main character?
Second, learn about the purposes of characters in novels. If two characters serve the same purpose, are both needed? Perhaps not. But how do we determine that?
I realized I was doing this more by "feel," than by logic or analysis. Therefore, I had to do research. Look at the great collection of articles I found!
This article is clear about the types of characters in a novel:
How Many Characters Should You Include in Your Story? by K.M. Weiland @kmweiland
I love the chart example with the characters in this article and plan to try it myself.
How many characters should a novel have? by Robert Wood
Like many things it's often hard to see in your own writing if you have too many characters. This is where your critique group or beta readers come in--they can point out where they are confused, or ask what happened to character D who disappeared from a scene, or even suggest how two characters are serving the same purpose.