I first started playing RPGs in middle school, mostly 2nd Edition Advanced Dungeons and Dragons. At that time I only wanted to participate as a player; I had no desire to actually run a game. It wasn't until many years later that I was forced into being the DM for a group. Most of the other people had barely played, so I was the most knowledgeable about the game. It was a good experience that taught me some hard lessons on how to run a successful game. Here's what I learned:
There is nothing worse during a gaming session than having the DM or GM frantically flipping through pages of the module or guidebook while the players all sit on their hands watching them. Long unplanned lulls in the game are jarring to the narrative flow of the adventure and ruin the fun for the players. A well-prepared DM can easily avoid this. The absolute first thing that you must do when you are setting up for a new campaign is to read through the entire adventure module. Make reference notes where appropriate and mark important pages such as maps and random encounter tables for quick reference later on. After you've done this, read through the module again. Your familiarity with the campaign will only enhance the player's experience.
You may also want to pre-roll for some areas of the adventure to save time. I find this especially helpful for treasure and loot rolls and rolling Hit Points for large mobs of bad guys. You could even pre-roll for random encounters on wilderness or dungeon campaigns where the characters will spend long amounts of time travelling between narrative combat. When dealing with rolls such as saving throws, ability checks and actual combat, you are going to want to make these rolls during the game or your players will accuse you of cheating and run amok. What you can do for combat is to figure out the strategy that the NPC combatants will use, e.g. in what order will the evil necromancer cast spells.
It Is Not You Against The Players
As the DM, you are the puppet master for all of the monsters and big baddies in the game, so it's understandable that you might bond with them the same way players bond with their characters. This is a good thing because it improves the way you play these villains against the PCs. They don't want to trek through a huge dungeon only to face a two-dimensional NPC that lazily fights them until their inevitable victory. They want a challenge. Provide that challenge, but don't go out of your way to try and make the players lose. Nobody wants their character to die, especially if they have invested a lot of time and love into that character. Killing off characters with impossible dungeons filled with diabolical traps and unbeatable monsters is a good way to lose players. Roleplaying games are supposed to be fun and no one has fun when their characters die.
There are going to be times when the players just don't want to live. They get beaten to within an inch of their life by shambling mounds right before they reach the dragon's lair. Do they wander off to rest before facing the dragon? Nope, they want to charge right in. Here is where you have to intervene as the DM. Start with gentle nudges within the framework of the game. Tell the PCs that they hear horrific screams and the sound of bone cracking from the lair. Describe how they can feel heat radiating out from the tunnel before they even enter it. If these clues don't do the trick, step it up. If there is a cleric or a paladin in the party, pull that player aside and explain how they received a vision from their god of the character's deaths. If forceful nudges like this don't work, then just let them charge the dragon.
Establish The Rules That Work For Your Group
There are a certain group of players and DMs that exist within the RPG fandom that are affectionately known as rules lawyers. These are the folks that have memorized every letter of every word on every page of every core rulebook and supplement. They treat every rule in there as unbreakable laws. There is nothing wrong with these players, but they belong in groups with other players like them. The same concept applies to DMs. If this is the way that you play, you need to run a group that doesn't mind calculating their movement rate based on encumbrance while walking through a village. If you try and run a game with a group of looser players, there are going to be constant arguments.
There is another problem that pops up with the looser groups. When you choose to ignore some of the rules, sometimes it is unclear which rules you are following. If there are specific rules that you won't be using and others that you are insistent on using, establish that right up front before the first die is thrown. The same applies for "house rules". If you have to, write these down so all the players know them. If a dispute about a rule comes up during the game play, I see several options. You can be a dictator and tell the players how it is going to be. I wouldn't recommend this option because it could cause resentment. The second option is to vote on it. This works better in larger groups. The last option, and the one that works for settling anything in an RPG, is to let the dice decide. DM gets odds; player gets evens and let a neutral player roll it.
Don't Be Afraid To Punish Players
Even though a roleplaying adventure should be fun and enjoyable, players need to have fun and enjoy themselves within the framework of the rules and the confines of the game world. To an extent this means that the players have to follow the narrative of the adventure and adhere to the personalities they have created for their characters. I'm all for characters finding their own paths to adventure but there are limits to my patience. I'll give you an example. The beginning of your adventure finds the party meeting in an inn. A local farmer rushes in, bloodied and disheveled, then collapses after uttering just one word: bugbears. The mayor puts out a request for brave heroes to seek out and destroy the bugbear menace. As a party of adventurers, the appropriate response would be to take up the quest. This is normally how it goes and everyone has a great time.
Unfortunately, I have run campaigns with players who would rather have their characters stay in town and pickpocket people or run around stealing from houses like they are playing a pen and paper version of The Legend of Zelda. So the easy solution is to have the character get caught, stripped of all their good equipment and forced sit in jail while the rest of the party completes the quest. The players might get mad if you punish them like this, but sometimes they don't give you a choice. If a player doesn't want to participate in the adventure, why did they even join the group? Go farm XP on World of Warcraft. If they fall back in line, give them back their stuff and have them join pack up with their party. If they continue to be a problem, it might be time for the group to make a decision about that player's continued participation.
Don't Be Afraid To Reward Them, Either
Sure the players get experience points, treasure and fame and glory from all of their adventuring, but sometimes they might deserve a little something extra. If you are running awesome campaign after awesome campaign with a great group of players there is no harm in giving out gifts. These gifts don't have to be magical weapons or trinkets, but even if they are make it fun. Come up with short personalized adventures (level appropriate, but not grinders) for each character to retrieve their prize. For example, if one of the players is a cleric, have them find out a legend about an abandoned temple to their god where a magical talisman is hidden. Take a break from your regular campaign to let them seek it out. Not only are these fun, but making them personalized allows the players to flesh out their characters more.
You can also reward players by bypassing dice rolls or tables in certain instances. For example, when mages are gaining familiars or druids are gaining shape shifting abilities, the DM can reward great players by allowing them to go off book. Obviously, some judgment needs to be used here to prevent a mage riding a wyvern everywhere he goes. I ran a campaign once where I allowed a paladin to have a giant rhinoceros beetle as their mount. It made sense within the confines of the game and it made the sessions more fun.