For over a year I have been the DM for a weekly in-person D&D 5e game with up to 13 players (other than me). Most weeks we have 7-10 players running PCs at the table. With that background, here is how I attempt to keep the game fun for everyone involved:
Know Your Audience
The DM should facilitate a Session 0 (and probably re-facilitate one every few months), but they also need to talk to each individual player away from the table to make sure everyone is engaged and having fun. With this many players, there will always be tension between focusing on combat (which is slow), role play, puzzles, plot development...
My players need to vent at times about choices the group did or didn't make, or give feedback on how I can adjust my DMing to make the game more enjoyable for them. This isn't as likely to happen in the full group as if there were only four of us though, so I have to take initiative to ask questions before and after each session.
Don't Split the Party
Most of the time I actively discourage splitting the party through in-universe and out-of-universe appeals. As a rule having three groups of players just leaves everyone sitting around longer waiting for me to adjudicate the outcomes of their character's decisions.
Sometimes though, we need the party to split to complete a plan or because they simply find they want to explore different parts of a city. My group shines at these points. We find a stopping points for each group where they can RP together in a way that will not require DM adjudication and they get to know each others' characters. There have been duels, impromptu raves, and quiet library visits, all with personality and color that make the scenes shine.
Do note that these moments are character-focused and role play heavy. Players that thrive on strategic combat or narrative exposition may not enjoy them as much. Players that feel the need to know everything that is happening, whether their character would or not, will struggle. It works wonders for helping everyone agree on the lines between what is known in-character and out-of-character though, since if your PC isn't in the room, you as a player probably missed the lore-dump conversation as well.
Change the Game (Warning: House rules ahead)
Share the Spotlight: Each player needs the ability to claim the spotlight each session. I replaced DM Inspiration with a system lets players basically invoke "The Rule of Cool" twice per session without breaking our game. (As a bonus, I gain a number of legendary actions for NPCs to help me balance the action economy without players feeling like I'm cheating.) I stole this system whole-cloth from another RPG.
Streamline Combat: On that note, certain optional rules, like flanking and facing, don't work with my large group of players. Combat is as simple and streamlined as I can make it while still keeping it engaging and interesting. I find succinct descriptions of each action and 4e minion rules are important tools for the action to move at a fast enough pace.
Fail Forward: I started with a fully open world and quickly learned that I needed to have rails, even if they're optional, for the party to follow. There have been a couple times I have taken players aside and asked them to adjust their character's attitude so that the party can progress. With a group this large you can plan for a while or talk chaotic stupid, but when push comes to shove, the party needs to make a decision and run with it. [The Angry GM's Tension Pool] (Note: Strong, if mostly censored, language) helps us with this. It's a mechanic that both threatens characters if they waste too much in-game time and signals to players that they are wasting too much out-of-game time.
No D&D is Better than Bad D&D
Finally, as you indicate you are aware, large group play is not for everyone. It's role play heavy and fights can turn into slogs. There are players who will prefer joining a smaller game more tailored to their preferences or just hanging out with the group. Periodically my group discusses breaking into two or three games, it's a healthy way to make sure that we are all having fun and that there are no hard feelings if someone chooses to find a different game or comes less often. We're still friends, we just might see each other one night less a week.