The main character or characters are the ones who carry the story forward. Ideally they should have the most interesting strand through the story and the story couldn’t happen without them. Of course, this doesn’t mean some readers won’t like a side character more than the main cast which is often how spin offs or characters joining the main cast can happen. This isn’t a sign of failure the cast of a story, especially in a series, often fluctuates and there’s no rule saying main characters have to all make to the end or outlive the side characters.
Our main character(s) is also known as our protagonist, we might call them the positive force of the story but this isn’t entirely accurate. We can have anti-heroes who aren’t always a traditionally positive force but they’re the character we’re cheering on and we want to win. They’re opposed to the antagonist or antagonistic force, it’s this opposition that makes them the protagonist rather than their morals. So to identify the main character/protagonist we need to give them a goal that is the foundation of the story whether it’s catch the criminal, change their life, or find love our protagonist is going to take us from the beginning to the end of the story.
This is part of what made George RR Martin killing off Ned Stark in Game of Thrones so shocking because for a large part of the story he appears to be the main character. The story begins with Ned Stark and it’s him that leads us through the world of King’s Landing. Martin’s books actually have an array of main characters, each of the narrators is a main character navigating us through different parts of the story and world. Arguably Ned Stark’s function is to introduce us to the complex world of Kings Landing, he’s the outsider finding the answers for the reader in this unfamiliar world. Perhaps in a similar way to the way Doctor Watson opens the world of Sherlock Holmes for the reader and asks the questions they want the answers to.
Another complication when determining who the main character is can come from the style of narration. There’s a form of narration where the narration is first-person/subjective but they’re not the main character/protagonist. An example would be The Great Gatsby where the main character is Gatsby but the story is told in first-person by a character called Nick, although he appears in the story they’re not driving it. We could imagine him on stage standing to the side of the action telling us about it while the other characters act it out. Although he’s a first-person narrator he isn’t telling his story, he’s telling someone else’s so he’s not the main character. The story of Gatsby and Daisy could still happen without Nick, it could be told in third-person/omniscient narrator but using a first-person narrator diametrically opposed to the main characters gives the story an unusual twist.
So our main character doesn’t have to tell the story, it might not even be who we expect, but they do need to be prompting the action to happen. If they weren’t there the story would be different or non-existent. They create change and drive the story forward, if they don’t maybe someone else in the main character.