Race Nutrition: The most important thing to remember is that you're limited by the number of calories your body can absorb.
If you plan to consume 300 calories/hour on the bike then 120 to 150 calories/hour on the run works well. If you prefer solid food like energy bars try to consume them in the first half of the bike leg when your body is less dehydrated to minimize the stress on your digestive system.
When you build your plan be sure to give yourself options. Just because something worked in training doesn't mean you'll be able to get it down your throat on race day.
And when bad things happen, such as bottles flying off your bike, expect it and prepare for it: carry an extra gel flask or some other calories source like chews or blocks just in case. The additional weight is minimal and the peace of mind is worth it, particularly in long races.
Post-race: The formula is pretty simple. Consume 50-100 grams of carbohydrate and 6-20 grams of protein within 15-20 minutes of finishing, preferably in liquid form. There are a number of pre-measured recovery drinks on the market that work well. If that's not an option then do what I do and drink a can of cold cola as soon as possible after crossing the finish line. It's not perfect but it tastes good and works pretty well.
Once the race is done quite often the party is on. Hold off for a little while and focus on getting in some good quality nutrition first. You'll recover faster and there's a good chance you'll reduce your muscle soreness, particularly if you're going to race again soon.
Stress and GI Distress
Stress has a huge impact on your ability to digest new calories.
When you get into high stress situations or what's commonly known as fight or flight you engage your parasympathetic nervous system.
One of the functions of the parasympathetic nervous system is to get you away from danger as quickly as possible. That means any unnecessary body bodily systems are shutdown. One of those systems is your digestive system because when you're in danger processing calories is not a priority.
The bottom line is your body doesn't know the difference between running from a lion or panicking in the swim.
In the weeks leading up to the race train yourself to be calm. Practice mindful meditation or deep relaxed breathing before and during training on a regular basis.
Be sure to build time for some relaxed breathing into your training plan. You want to visualize yourself being calm and handling the swim start and all the other drama in the transition areas with ease.
The more relaxed you are the morning of the race the easier your body can access and shuttle those valuable calories to your working muscles they so desperately need.
Search for your next triathlon.