Some general advice I’d give to GMs is to 1) know your players, their expectations, strengths, and weaknesses and 2) communicate the general feel and style of game you are looking to run. A RPG group is just like any relationship, communication and constant checkups are key to making it work.
Whenever I plan a game, I inform the players about the general level of input they have into the story (never in those terms of course). My most recent game had the players as inquisitors in a backwater region sent to look into the various rumors and accusations of heresy. I told them that their position meant that they had the freedom of what to investigate when and how and even what to bring to trial or not. The events of the game were then completely driven by how the players prioritized things.
My practice that has had the most significant impact on the quality of my games by far is checking up on players. Between most sessions, especially after heavy plot events, I do my best to ask what my players think of the game so far. I try to gauge their level of interest in the story, ask what they think is happening, what they are planning for the group and their characters, how far they think they have progressed and how much further they have to go, etc. This gives me an indication on what is working and what isn’t. There are times where they tell me what they think the direction of the story is and it is way off, so in the next session or two I give them information to correct them (or maybe throw in a red herring if they are too close). Sometimes they story is halfway done, but the players feel they are only 25% of the way through, that generally means I need to progress their characters more and give them heavier story elements.
Basically, the TL;DR is communicate with your players constantly, outside of the game to ensure everyone is having fun and understands the goal and style of the game.