The advice is simple: When you ask yourself “What should I do,” oftentimes the best answer is “Stop being a DM.”
When you build a dungeon, don’t build a dungeon. Think about what it was built for. No one builds a dungeon for adventurers to crawl through. Maybe it’s a cave that just naturally exists. Maybe it’s a temple. Maybe it’s a dungeon, as in a prison. Whatever it’s supposed to be, build one. Build a temple. Think about who the temple venerates, and how this affects the design. Think about what the worshipers want from a temple. Do the clergy live there? What resources will they need? Put on your hard hat, and build these worshipers a temple. Now populate it. Who lives there? Are they the original inhabitants? If not, where did the original inhabitants go? If so, what are they doing? Why are they there? Now that you have a dungeon and some inhabitants, let the players in. There’s plenty of posts on this page with detailed advice on the subject, if you want more detail.
To build a villain, don’t build a villain. Become the villain. What do you want, and why? What resources are at your disposal? Now, form a plan. How will you use your resources to pursue your objective? What obstacles stand in your way? What are your weaknesses? Now that you have a villain, put your DM hat back on, and unleash him/her/it on the world. There’s plenty of posts on this page with very detailed advice on the subject of villain-building.
To build an NPC, don’t build an NPC. Be a person. Think about where you live, and why. Think about what your opinions and motivations are, and how they affect your personality. Think about what you need and want. Now zip up your NPC skin suit, and react to the party’s actions. Based on your character, how do you feel about what the party has to say? How will you react? What can these adventurers do for you? What do you think of them? Now unzip your skin suit, or take off their shoes if you’re not crazy, and make the reaction happen.
To be a DM, don’t be a DM. Think in terms of the world. The world exists, and the players simply live in it. The world isn’t built around the players. Think about what will happen in your world, what has happened, how things work, and what current events are like. Think of the world. Live in the world. Be the world. Now, how will the world react to the players’ actions? What will the players experience as they walk through the world? Now take off your world suit, reassemble your corporeal body, and make it so.
Now, there’s plenty of links on this page with amazing advice for almost every aspect of the game, very specifically and with a lot of detail. However, the best general advice I’ve ever seen is still one simple principle: To be a DM, don’t be a DM. When you encounter a problem, don’t ask “What should I do?” Ask “What would happen?” This world you’ve built alongside your players has a life of its own. Let it live, and simply act as the intermediary and interpreter. To be a DM, don’t be a DM. Be a narrator.