Everyone knows that you should test everything before a race - especially if it's an ultra. However it may challenging or impossible to simulate all the race conditions exactly during training. Even if you try the same race again, it might be quite different the next time due to weather and so on.
You should study everything about the race course and probable weather conditions. You should try your shoes, socks and other clothing and gear during long training runs. You should make a list what you need on race day, including your drop bags, and then double-check and triple-check everything.
Still, people do make mistakes in races due to nervousness. Like when I once forgot some unprotected salt caps in the back pocket of my shirt in the bike leg of Ironman Hawaii triathlon, but that's another story.
Race nutrition is certainly one of the most difficult things to get right. Some people like Geoff Roes try to keep it simple and take only gels, salt and water all day. That sounds like a good starting point for experiments, although most people would prefer to eat some sort of 'real food' at some point.
The video below shows how Michael Arnstein prepared for Western States 100 Mile Run in 2011. The Fruitarian had DNF'ed in 2010, so he wanted to prepare really well and get everything right this time. He thought it would be a good idea to eat avocados and dates, since had used both successfully before. Unfortunately he had never tested them together...