"I'm new to D&D, and want to learn how to play [or DM]. Where do I start?"
So you've never played D&D before, but you are dice-curious... You've come to the right place! First, let me say "Welcome!" I hope your experience is a wholly positive one that adds a new life-long hobby for you. This brief guide is not going to tell you how to play (mostly), but just where to start so you can then find some people and learn how.
For New Players
For the new player, the most common question is something along the lines of "How do I learn to play?" or "How do I find a group willing to teach?"
First start with the Basics (pun intended). Wizards of the Coast offers the D&D Basic Rules for free. The Player's Basic Rules PDF give you everything you need to play a Fighter, Cleric, Rogue or Wizard from 1st to 20th level. Yes, the Player's Handbook offers more class options, but if you are just looking to learn the game, no need to invest in the books yet (although you probably will eventually). Aside from the Basic Rules, there are several other free PDFs, but you don't necessarily need any of those (yet).
Ignore any advice on the internet that tells you "Read the whole Player's Handbook!". In the Basic Rules, the core mechanics are just a couple dozen pages. If you just want to know the most essential part of the rules to understand the game, you can start with the Introduction (3 pages), Chapter 7 - Using Ability Scores (6 pages), and Chapter 9 - Combat (9 pages).
Honestly, you can get by with just about 20 pages... Yes, once you have a character in hand you will want to read about his or her Race and Class (Chapters 2 - 3), but that can be secondary. The core rules are all contained in 18 pages! Most of the rest can be learned at the table. Caveat: If you are playing a Cleric or Wizard, you will have to read and become familiar with spell casting. It can't be helped.
Wizards of the Coast offers several pre-generated characters of various races and classes. It's usually good to start out with one of these since you won't be very familiar with what are the optimal choices during character creation. But if you want to try your hand at it, read Chapter 2 of the Basic Rules, which walks you a character creation example step-by-step.
Now, if you also have a novice DM already willing to play with you, be a sport and read as much as you can. You will all be learning together, so it is only fair you try to know the rules in order to help him or her. They should not have to shoulder the burden of knowing all the rules for a whole group of novices. If your DM is experienced, this is less of an issue.
Next is, "How do I find a group?"
find a D&D Adventurers League game at your Friendly Local Game Store (FLGS) through the Wizards of the Coast site. These are short gaming sessions hosted in a local game or comic shop to help introduce new players to D&D. Enter your zip code and then click on the stores listed to see if they have "D&D Adventurers League" night on their calendars (often Wednesdays -- it also helps to call the store to confirm). The difficulty with D&D AL is that the adventures run in "seasons" which means it can be a little jarring to join a story line midstream. It can be like coming into a foreign language film after the first hour. Not only do you not know the plot, everyone is using words you don't understand. But fear not (!), as most D&D fans are quite welcoming to new players!
There are also several "player/game finders" on the internet, but one of the better ones is MeetUp.com. There may be a role-playing group nearby, but even if there isn't, you might want to check out board game or Fantasy/Sci-Fi fandom groups. There is often a fair amount of fan cross-over in those interests, so you may be able to find D&D players. You can ask the moderator if it's okay to ask/post about D&D in the group.
There are also many DMs who host games online through Google Hangouts, Twitch, Discord, or other chat/webcam software. Post in Facebook or Google+ social media groups asking if there are any online games interested in new players.
For my money, in-person, face-to-face D&D is the most fun, which is why I like MeetUps or the local game store to meet new gamers, but explore any opportunities to play and learn, online or off.
For New Dungeon Masters
Perhaps you already have a small group of friends who all want to play, but do not have an experienced Dungeon Master to guide you. Congratulations on volunteering!
Now take a deep breath... Don't worry about being a "bad" DM or not knowing all the rules. Your whole group is new, so it will be a wild ride learning together. The bad news is that you are likely in for a lot more reading than your players.
The DM's Basic Rules doesn't really contain any new rule mechanics (over the Player's PDF), but you will need it for the monsters. It contains a relatively sizable bestiary as well as some treasures you can add in to the campaign. The core rules of play are still all in the Player's Basic Rules. As a new DM, you should probably limit yourself to 3 to 5 players. Too many or too few players is hard to balance as a new DM and can present its own challenges outside of the rules learning curve.
D&D Starter Set. For about $15, it has pretty much everything you need as a new Dungeon Master out of the box. The DM's rule book includes all the core mechanics from the Basic Rules, but re-organized slightly for ease of reference for a DM. The adventure, while somewhat linear, offers scenarios and encounters that slowly introduce you and your players to key mechanics in play. It is very well written and an entertaining adventure. The box set even comes with pre-generated characters, so you can jump right into the action.
You don't need to digest the entire adventure. For your first session, you can just run the first few encounters, the goblin ambush and the Cragmaw Hideout.
Take my advice and skip character generation for the first few sessions. With a new group, this can take to long and deflate some of the initial excitement. Use the pre-gens and wait until everyone has a little bit better grasp of the system before they create their own characters.
You could also run something short and sweet. Matt Colville created a nice little simple 5 encounter adventure that you can run in a single session. You could run that as a pre-cursor to the more involved, longer Starter Set campaign.
For general advice, there are a crap ton of D&D bloggers and a number of YouTubers who offer new DM tips. Many people enjoy Matt Colville's Running the Game YouTube series... although his quick cadence can be a little hard to get used to at first. There is also Matt Mercer's "GM Tips" series, which dig beyond the game basics.
There are also some more off-kilter, but fantastic, bits of advice from Hank "Drunken & Dragons" Fernell (sp?)... Especially this video starting at about minute 10. This video boils D&D down to a couple simple ideas in order to introduce your players to the base concepts. He doesn't follow the D&D rules, per se, but he simplifies the mechanics in a way that will make it easy to introduce your fellow novices to the core mechanics in play.
Poke around social media. Poke around YouTube... there is a lot of advice out there. Don't believe everything you read or hear, but keep an open mind and the best ideas will float to the top.
If you think you are serious about DMing, the Dungeon Masters Guide for D&D 5th Edition is one of the best that has been written thus far. It collects the wisdom of the last 40 years of D&D and distills it down to a pretty, damn good book. There's a lot in there, so don't feel like you have to plow through it all. Read a chapter here or there when you have some down time. It's not a necessary purchase to run D&D from a rules standpoint, but it will certainly help you run a game.
How to play D&D - A Primer for new Players and DMs
I'm developing a newbie primer for playing D&D (because Wizards of the Coast has a few holes in its introductory documentation). This page will link the the various blog posts and documents related to this work in progress.
In Part 1, I illustrate a fictional "example play" between a DM and her new player. I talk about the character's actions and how the DM adjudicates the results with page references to the D&D Basic Rules.
Part 2 is a PDF of the character sheet with annotations of the PC that is used as a character generation example in Chapter 1 of the Basic Rules.
Parts 3 and 4 will hopefully spring to life in the near future... but I hope what I've written to far puts you on the right path.
Part I: A D&D Primer (example play - work in progress)
Part II: The Annotated Character Sheet
Part III: Expanded Example Play Scenario (for DM's)
Part IV: Detailed Combat Example
Lastly, I've started a series on "Game Mastering 101", which describes my gaming style at its most basic levels. I don't claim to be the be-all, end-all of game masters, and I've certainly made more than my share of GM mistakes over the years, but I hope others can learn from my mistakes and hard lessons.