Ultra-runners end up with a very efficient fat-burning metabolism and a very good idea of what food works for them.
Fundamentally, you physically cannot take in enough calories to keep up with the energy expended so your body must switch to burning fat. (There is a maximum gastric emptying rate; combine that with the need for the fluids to be at the same concentration as human blood (or you get osmotic exchange and water goes where you don't want it) then you get a limit of about 200-300 calories/hour.
Ultra races have aid stations. The distances vary but every 5-10km or so is normal. What they offer is pretty standard: water, sports drink, chips, boiled potatoes and salt, oranges, peanut butter and jelly sandwiches.
Lots of easy carbs and salt. There are often other things as well: chocolate cake, sometimes burgers or a hot dog. I grabbed a hot dog near the end of a 50km race; it was awesome!
I, and other ultra runners, often take the attitude of showing up at an aid station and finding out what the body wants. We eat that and then go.
Ultra runners also use sports drink. Normally quite specialized it's mostly a variety of simple sugars at 8% concentration + sodium, potassium, magnesium and calcium. For longer ultra, there's an argument that replacing 1% of the sugar with protein helps slow down muscle break down.
Many of the faster ultra runners will run with two hand bottles: one has water, the other the sports drink. When they feel their stomach is getting a bit over concentrated with the sports drink (common on hot days) they will switch to drinking water to smooth things out.