Campaign Planning
Planning out a campaign is difficult for a variety of reasons. Mapping the ebbs and flows of the story, plotting the course for antagonists, and laying plot hooks can all take a great deal of planning and forethought.
This article will help you with none of those problems. Instead, this article breaks down the underlying math and mechanics of a campaign run from 1st level through 20th, including all of the encounters, experience, and treasure. By making some base assumptions we can build the mechanical skeleton of a campaign and determine exactly where things need to go.
But why do this? Why is this important? Because I have never once met a DM who thought of an entire campaign starting at the beginning and proceeding in order to the end. That's now how people think. If you've ever had a great idea for a dungeon or a piece of treasure and didn't know where to fit it into your campaign, this article will help you do it. If you've ever worried that you don't have enough content to get players to level 20 (which isn't necessarily a bad thing), this article will help you find out where you have gaps. If you've ever worried that you're not giving your players enough treasure, this article will help you determine exactly where and when you should place it.
This article clearly answers several questions about 5th edition and its underlying math:
 How many encounters should players face at each level?
 How much gold should I give my players at each level?
 How many magic items should I give my players at each level?
 How many ingame days does it take to reach level 20?
Assumptions
The remainder of this article relies on a handful of assumptions. Tweaking these assumptions will result in changes to the "skeleton" which we will be building in this article.
Experience Points
The campaign skeleton will assume that you are awarding experience points rather than using "Milestone Leveling" or some other system. This means that players will need a certain number of encounters of CR equal to their level worth of experience to gain a level.
This is one of the easier assumptions to change. You can use the campaign skeleton to get an idea of the number of encounters to include, then abandon experience points altogether, thereby achieving more flexibility in encounter design without altering the pace of the game.
Default Random Treasure
The Dungeon Master's Guide includes rules for random treasure. These rules don't account for games with varying levels of magic, and they assume that you are using magic items in your game. We will make the same assumption because the majority of Dungeons and Dragons campaigns include magic items.
If you don't want to use magic items in your game, remove them. 5th edition is balanced to be played without magic items, so this shouldn't have any further effect on the campaign skeleton.
4Player Party
The math for CR assumes that a single creature is an averagedifficulty encounter for four player characters. Therefore, the rules for treasure assume that the treasure is divided among four characters. I'll attempt to break this down into individual treasure to allow the campaign skeleton to scale up and down for parties of different sizes, but some amount of rounding will be required.
The Adventuring Day and Short Rests
Page 84 of the Dungeon Master's Guide describes "The Adventuring Day". This establishes a rough guideline for how many encounters players can handle in any given day, and suggests roughly two short rests per day. These assumptions give us a guideline for how much adventuring you can squeeze into a single day, which in turn tells us how quickly you could expect to run players from level 1 to level 20 if you were to do nothing but adventure as quickly as possible.
Gaining a Level Requires a Long Rest
While there is no rules guidance on the subject, I'm going to assume that you require players to complete a short rest before gaining a level. Gaining a level without taking a long rest introduces a lot of very complicated math that I don't find interesting or meaningful.
A big pile of math
If you want to just trust me and ignore all of this interesting and useful math, skip to The Skeleton, I won't think any less of you, But if you want to understand the math and logic behind how I built the skeleton, settle in for some math, statistics, and tables full of numbers.
How many encounters per level?
The table below includes the math to determine how many encounters of average CR will bring a player to the next level. Based on our assumptions discussed above, this assumes a party of four characters facing encounters made solely on single monsters of CR equal to the players' level. This math largely disregards experience from other sources, but it tells us enough that we can build the skeleton.
The table reveals some really interesting information:
 The number of encounters per level is almost never round. It's hard to know why this is the case, but if I had to guess it's because Wizards chose nicely rounded numbers for the experience to reach the next level without directly considering how much experience an encounter would grant.
 The number of encounters per level ramp up significantly at 3rd level once characters are established and have all selected subclasses, then drop to 89 encounters per level at 11th level, likely because encounters become more complex at the beginning of Tier 3.
 The daily experience budget allows roughly 56 encounters per day at every level except 5th, which allows more than 9.
 It will take a total of just under 200 encounters worth of experience to bring a character to 20th level.
 It will take just over 30 days for players to reach 20th level if you allow leveling in the middle of a day, or 42 days if you require a long rest to gain a level.
Level / CR  CR Exp.  Exp. per Player  Exp. for next Level  Exp. to next Level  Encounters to next Level (Raw)  Daily Exp. Budget  Encounters Per Day  Days to Level 

1  200  50  300  300  6  1200  6  1 
2  450  112.5  900  600  5.33  2400  5.33  1 
3  700  175  2,700  1,800  10.28  4,800  6.86  1.50 
4  1,100  275  6,500  3,800  13.87  6,800  6.18  2.24 
5  1,500  375  14,000  7,500  13.04  14,000  9.33  1.40 
6  2,300  575  23,000  9,000  15.65  16,000  6.96  2.25 
7  2,900  725  34,000  11,000  15.17  20,000  6.90  2.20 
8  3,900  975  48,000  14,000  14.36  24,000  6.15  2.33 
9  5,000  1,250  64,000  16,000  12.5  30,000  6  2.08 
10  5,900  1,475  85,000  21,000  14.24  36,000  6.10  2.33 
11  7,200  1,800  100,000  15,000  8.33  42,000  5.83  1.42 
12  8,400  2,100  120,000  20,000  9.52  46,000  5.48  1.74 
13  10,000  2,500  140,000  20,000  8  54,000  5.4  1.48 
14  11,500  2875  165,000  25,000  8.69  60,000  5.22  1.66 
15  13,000  3,250  195,000  30,000  9.23  72,000  5.54  1.67 
16  15,000  3,750  225,000  30,000  8  80,000  5.33  1.50 
17  18,000  4,500  265,000  40,000  8.89  100,000  5.56  1.60 
18  20,000  5,000  305,000  40,000  8  108,000  5.4  1.48 
19  22,000  5,500  355,000  50,000  9.09  120,000  5.45  1.67 
20  25,000          120,000  4.8   
Total Encounters:  198.19  Days to Level 20:  30.3 
Treasure
The final paragraph on page 133 of the Dungeon Masters Guide sets an expected number of rolls on the Treasure Hoard tables, but does not specify how much treasure to award from the "Individual Treasure" tables, so the table below attempts to fill in the missing information. We'll assume that each treasure horde replaces the treasure for one encounter, and the remaining encounters will use the individual treasure tables.
Unfortunately, because the number of encounters per level is almost never a round number, neither is the number of rolls on the treasure table. Fortunately we don't actually need round numbers because this is all an exercise in math and probabilities which will end with a pile of coins of various denominations.
Tier  Encounters  Hoards  Individual Treasures  Average GP per Individual Treasure  Average Total GP 

04  35.48  7  28.48  3.52 gp  100.28 gp 
510  84.96  18  66.96  78.5 gp  5,256.36 gp 
1116  51.77  12  39.77  851.75 gp  33,874.10 gp 
17+  25.98  8  17.98  8470 gp  152,290.6 gp 
Total GP gained over 20 levels:  191,521.34 gp 
Treasure Hoard Distribution
We've now established how many times the DM will need to go roll on the random treasure tables in each tier, but that leaves us with large ranges over which to distribute treasure hordes and no official guidance on how to do so. I've got several ideas for how this could be done, so we'll go through them in what I think is worsttobest order. I'll include a table and graph at the end to clearly lay out horde distribution so that we can compare them easily.
Big Pile
Award all treasure hordes in the final level of the tier.
This is an outright terrible idea. Players will go through huge stretches with no treasure greater than the change rattling around in enemy pockets, and won't get new magic items for long periods until suddenly they find a pile of them in some dungeon or something and experience a sudden and confusing leap in power.
Flat Distribution
Distribute the hoards evenly over the level tier.
This is a perfectly fine way to do things, but it has some warts. Entering a new tier comes with a sudden and significant jump in the value and power of treasure which players find. Toward the end of the tier treasure feels lackluster because players are getting the same quantity of treasure that they recieved several levels prior.
Ramp
Distributes hoards such that each level has more hoards than the previous level.
Comparison
Method  

Tier  Level  Pile  Flat  Ramp 
1  1  0  1  1 
2  0  2  1  
3  0  2  2  
4  7  2  3  
2  5  0  3  1 
6  0  3  2  
7  0  3  3  
8  0  3  3  
9  0  3  4  
10  18  3  5  
3  11  0  2  1 
12  0  2  1  
13  0  2  1  
14  0  2  2  
15  0  2  3  
16  12  2  4  
4  17  0  2  1 
18  0  2  2  
19  0  2  2  
20  0  2  3 
The Skeleton
With the above information in mind, we can finally build our campaign skeleton. Think of this skeleton as a long list of blanks which need to be filled with encounters and rewards. We'll use the "ramp" method for distributing treasure hordes, but feel free to replace this with other methods if you'd like.
In addition to the option of randomly generated treasure hordes, I've included column for manually specified treasure. The logic for this column is taken from this ENWorld forum post which goes into the statistical distribution of magic items over a character's career from levels 1 to 20. The treasure horde rules don't scale well for parties of more/less than 4 players, but the analysis in the forum post makes it very easy to scale the number of magic items in your campaign to accomidate parties of differing size.
Level  Standard Encounters  Individual Treasures  Hoard Encounters  Treasure Hoards  Precise Magic Items 

1  5  5  1  1 

2  3.33  4.33  1  1 

3  8.28  8.29  2  2 

4  10.87  10.87  3  3 

5  12.04  12.04  1  1 

6  13.65  13.65  2  2 

7  12.17  12.17  3  3 

8  11.36  11.36  3  3 

9  8.5  8.5  4  4 

10  9.24  9.24  5  5 

11  7.33  7.33  1  1 

12  8.52  8.52  1  1 

13  7  7  1  1 

14  6.69  6.69  2  2 

15  6.23  6.23  3  3 

16  4  4  4  4 

17  7.89  7.89  1  1 

18  6  6  2  2 

19  7.09  7.09  2  2 

20      3  3 


That's a very strangely shaped skeleton.
Planning Encounters
Humor aside, we now have our campaign skeleton. Now we know exactly how much content we need to put in front of the players to get them to 20th level. But we still have one lingering question: What do we do about the nonround numbers? A DM can't actually make 0.65 encounters.
Remember that not every encounter needs to be a single monster of CR equal to the party's level. Use encounters of varying difficulty; their experience point values will vary accordingly, and by adjusting the difficulties of a few encounters up and down you can easily hit nearly any number. I recommend making roughly 25% of encounters easier than normal, 25% harder than normal, and 50% average difficulty. By adjusting the total experience value of encounters and adding in experience for traps, puzzles, and story rewards You can easily compensate for nonround numbers of encounters.
Example  Planning a Level
Planning out any single level is roughly the same. To illustrate the process, we'll plan out content for taking a party of four characters from 4th level to 5th level.
The Skeleton specifies that it will take 13.87 encounters (10 regular and 3 hoard encounters) to take players from 4th level to 5th level, and the daily experience budget for 4th level gives us room for 6.18 encounters per day. That means that players will need to face 2.24 days worth of experience to reach 5th level.
We can address that in two ways: we could spread the encounters over three adventuring days, stretching our experience budget a little bit thin and making each individual day a bit more manageable for the players; or we could do two days worth of adventuring and award some story experience rewards for things other than fighting monsters like traps, puzzles, and story rewards.
In this example we'll go for the second method. We'll assume that each adventuring day includes a handful of traps, a puzzle, and a small story reward at the end of the day.
I like to make roughly 25% of encounters below average difficulty, and roughly 25% of encounters above average difficulty. 6 doesn't divide into neat quarters, but we'll have 12 easy encounters per adventuring day and 12 hard encounters per adventuring day. Easy encounters should generally be grouped with hard encounters in order to stay within the daily experience budget so that players' daily resources aren't overtaxed to the point that they don't have a reasonable chance of success.
We also have three hoard treasures to award, and I've always liked awarding more treasure for harder encounters, so I think we'll award treasure hordes for our hard encounters where it's possible to do so.
Encounters  XP Threshold  Day 1  Day 2 

Easy  500  1  2 
Medium  1000  4  2 
Hard  1500  1  1 
Deadly  2000  0  1 
Free XP    800+  300+ 
Individual Treasure    5  4 
Treasure Hoards    5*  2 
*  Because we've deviated from the assumption of 1 monster of CR To keep to the expected treasure, we'll add an additional individual treasure. This could awarded from a trap, rolled into a treasure hoard, or awarded at some other point in the adventure. 
That gives us a rough idea how we'll lay out our two days of adventuring at 4th level. How we join the two days doesn't matter all that much. They could be party of a multiday adventure like a long dungeon delve, or they could be two totally separate adventures. It doesn't really matter for our purposes because this is just an example and I'm not actually running an adventure.
From here, all you need to do is create the encounters, roll the treasure, and drop them into your game. I won't go into the details of planning each encounter: encounter design is worthy of its own article.