I’ve done another post already on what you should eat before a 5k.
In general, here’s what you should do for longer runs.
1. Carb up. Lots of carbohydrates and hydration. Complex carbs are OK eg the cliched pasta.
2. The day before the race DO NOT EAT COMPLEX CARBS. Eat simple carbs. Too much pasta will still be there in the morning. Again stay hydrated. If it’s hot remember you might die if you drink too much water and leach all your salt out of your body so make sure you have plenty of salt in you. A total of about 1 teaspoon a day in all you eat is enough. Too much salt also kills you! Joy!
3. Race day. You have to carry digest, metabolise etc all you eat. So keep it simple. I have a banana and some lucozade sports. For a 5k or 10k you don’t need them really. Just eat enough to avoid being sick and avoid eating too much so that you are sick! Hmmm.
4. Before the race CAFFEINE. Get your body in focus with a psychological boost.
5. During the race. Only if it’s hot or more than 10k would I have liquids. Certainly don’t carry them. For longer races, I would try for a lucozade sport every 30-45 minutes as a simple rule of thumb. Maybe every 45-60 mins if you don’t think you are fast.
6. After the race. Protein within half an hour and some carbs every couple of hours especially after long races. Plenty of salts and liquids.
That’s the general gist of it. I’m not a dietician and I’ve never run a marathon (nor do I intend to you mad people!!). If you are just doing a race but not competitively I suspect that none of the advice from anyone on the net is really relevant just make sure you are hydrated pre-race, would cover that scenario.