At the end of my last article I mentioned the basic fatigue causes related to diet during the competition (race). I planned to explain them in a singular article, but as is often the case, I failed, so only one of them (prevention of spending all glycogen reserves) will take up an entire article.
Spending up glycogen reserves is one of the most common limiting factors in endurance sports. In a marathon race, as many as 40% of runners experience this.  We must emphasize that this is the total percentage of all runners, so mostly recreational athletes. Professionals are (more) aware of the potential problem so they manage to avoid it more or less successfully. The moment in which an athlete experiences reaching the bottom of glycogen reserves is often described as hitting the wall. Suddenly you feel tired due to significant lack of carbs and the rise of fats ratio in the „fuel“ for your energy consumption.  Let's remember, the body almost always uses a certain ratio of fats and carbs as an energy source, depending on activity intensity and level of glycogen. Hitting the wall consequently leads to inability to maintain the intensity of the activity, because all energy from fats releases slower and its expenditure demands a higher oxygen consumption. In other words, the body can't produce energy for the necessary level of intensity fast enough.
Carbohydrate intake before the competition (Carb loading)
The problem of spending glycogen reserves is prevented via dietary interventions before or during the race (competition) or via combination of the two. A common practice of many before the race is carb loading. Some merge these two words into carbo-loading, and literature also gives us the term glycogen super compensation. Loading for athletes, partial or complete, is in reality done on a daily basis. Every meal that has carbs will lead to a certain glycogen loading, if the person isn't in the middle of a significant calorie deficit. If the person has a positive energetic balance (calorie suficit) and their diet contains enough carbs (6-10 g/kg body weight), glycogen levels will fill over the usual levels – they will be super compensated. 
Other than dietary intervention, super compensation usually requires a period of shorter and lower intensity training. This is called tapering. Many use the unnecessarily fatiguing method of super compensation that includes two main phases. First one includes emptying the glycogen reserves through a period of low carb low calorie diet followed by high levels of physical activity for a couple of days. Second phase creates a calorie suficit reached with a higher carb intake followed by reducing of physical activity for up to 5 days.  Research shows that this complex method is no better than simply creating a calorie suficit through higher carb intake 2-4 days before the competition.  Through the deficit phase there's greater risk of injury, and the lack of energy can lead to drop in motivation levels. 
Is carb loading necessary for endurance sports success? It depends mostly on the duration and intensity of activity. Generally speaking, every activity of serious intensity longer than 2 hours will require carb loading for optimal results. We should also keep in mind that many athletes unconsciously perform carb loading. If they have calorie balance and adequate carbs intake in their normal training process, during the tapering period they will reduce energy consumption and keep the intake level, which will lead to calorie suficit, and glycogen levels will partially or completely fill up.
I personally prefer and use carb loading by creating an energy suficit of cca 800 kcal per day, mostly carbs, during the last 3 days before the competition. Notice I haven't recommended an extra 800 kcal per day exclusively in the form of carbs. Let's do some math. It's not complicated, don't worry. Bear in mind that carb loading goes hand in hand with tapering and reducing energy consumption. Even though there are several methods of tapering which reduce consumption differently, let's use an example of 500 kcal. So, assuming that an athlete is in calorie balance during their training process, tapering itself creates an excess of 500 kcal. Adding 300 kcal per day to the athlete's usual daily diet creates the recommended number of 800 kcal suficit. When considering the „type“ of suficit, even though it's not of essence that the excess comes from carbs, it is desired that they make at least 60% of daily intake. This can be shown as 8-12 g of carbs per kilo body weight.  Type of carbohydrates is not important for loading itself and can be chosen according to individual preferences and practicality, but I would recommend avoiding large intake of fibers because they make us feel full, which could compromise the intake of quantity of food (energy) we need for carb loading. This recommendation particularly stands for the day before the race, when fiber intake could result in gastrointestinal problems on the very day of the competition.
Carb intake during the competition - Carb reloading
Another way to avoid emptying glycogen reserves is carb intake during the race – filling up the reserves through energy gels, bars or drinks. As I mentioned in the previous article, this method is limited to their absorption in smaller intestine. So it is mostly used as an extra push for carb loading in the activities longer than few hours like cycling and long triathlon. However, carb intake during the race has an added value – it benefits the central nervous system, the motivation, has a neuroprotective influence.  Interestingly enough, just washing out your mouth with water that has carbs in it can have a positive effect on performance.  Carb intake during the race is measured in grams per hour (g/h), and the upper level of effective absorption is around 90 g/h – it's individual and depends on digestive system.  Intake larger than the one we can absorb can lead to digestive problems such as cramps and diarrhea. In other words, just as we train the body and mind for strains, we must slowly train our digestive system for an enlarged carb intake. A common mistake that recreational athletes make is that they try out a dietary tactics for the first time during the race. This greatly increases the risk of digestive problems, and might compromise the result and even make you quit the race.
Unlike with carb loading, the type of carbs we ingest during the race is very important. Glucose and its polymers (maltodextrin) are equally efficient, , but maximal absorption of glucose itself is 60-79 g/h. Since fructose absorbs separately in smaller intestine, if we add it to glucose, we can increase these numbers to 80-90 g/h or up to 1,2 g/kg BM. We don't need to emphasize that fiber intake is not desirable during the race, just like fat intake, be it medium chain triglyceride (MCT) or long chain triglyceride (LCT). Intake of these does not help the performance, and it could cause digestive problems.  Protein intake, if the carb intake is correct, will not have a positive effect on performance, and since proteins are quite an inefficient energy source (25% of their energy is spent on metabolism), they're not desirable.
Carb intake after the competition - Recovery
There's no need for a specific diet after the competition, since it's almost always followed by rest phase, during which carbs mostly end up in glycogen reserves. An exception would be a situation where two or more competitions occur during the day. Then carb loading is recommended right after the end of first competition. Same goes for two or more trainings per day. If the second competition is less than 24 hours away, most carbs should be ingested in their simple form (sugar) for faster absorption.
Before the competition: 2-4 days before the competition, 8-12 g/kg BM, no emptying the reserves
During the competition: 60-70 g/h of glucose or its polymers + 20-30 g/h of fructose
After the competition: the usual diet with enough carbs
 Rapoport, Benjamin I. "Metabolic factors limiting performance in marathon runners." PLoS Comput Biol 6.10 (2010): e1000960.
 Margaria, R., et al. "Energy cost of running." Journal of Applied Physiology 18.2 (1963): 367-370.
 Burke, Louise M., et al. "Carbohydrates for training and competition." Journal of sports sciences 29.sup1 (2011): S17-S27.
 Bergström, Jonas, et al. "Diet, muscle glycogen and physical performance." Acta Physiologica Scandinavica 71.2‐3 (1967): 140-150.
 Sherman, W. M., et al. "Effect of exercise-diet manipulation on muscle glycogen and its subsequent utilization during performance." International journal of sports medicine 2.2 (1981): 114-118.
 Jeukendrup, Asker E., Roy LPG Jentjens, and Luke Moseley. "Nutritional considerations in triathlon." Sports Medicine 35.2 (2005): 163-181.
 Lambert, Estelle V., and Julia H. Goedecke. "The role of dietary macronutrients in optimizing endurance performance." Curr Sports Med Rep 2.4 (2003): 194-201.
 Carter, James M., Asker E. Jeukendrup, and David A. Jones. "The effect of carbohydrate mouth rinse on 1-h cycle time trial performance." Medicine and science in sports and exercise 36.12 (2004): 2107-2111.
 Jeukendrup, Asker E. "Carbohydrate and exercise performance: the role of multiple transportable carbohydrates." Current Opinion in Clinical Nutrition & Metabolic Care 13.4 (2010): 452-457.
 Rowlands, David S., et al. "Glucose polymer molecular weight does not affect exogenous carbohydrate oxidation." Medicine and science in sports and exercise 37.9 (2005): 1510.
 Hawley, John A. "Effect of increased fat availability on metabolism and exercise capacity." Medicine and science in sports and exercise 34.9 (2002): 1485-1491.
 Nicholas, Ceri W., et al. "Carbohydrate intake and recovery of intermittent running capacity." International journal of sport nutrition 7.4 (1997): 251-260.