Performing on long and tiring tour
Basically, it's 2 things; training and nutrition. My guess is that you either didn't get in enough quality training and/or you were not properly nourished on the ride. 

For Training

One of the best ways to build up to longer rides and ride them enjoyably is through interval training.

The best book I've found on the subject is: The Time-Crunched Cyclist: Fit, Fast, and Powerful in 6 Hours a Week by Chris Carmichael. The book includes a lot of info on lactate threshold, energy metabolism, nutrition, race and century training plans, etc. I first tried out his methods after reading one of his articles in Bicycling magazine on century training. Another great source for long distance training plans and ride nutrition is Joe Friel's blog for endurance athletes.

Basically, Carmichael's methods are a form of interval training where you are doing things like hill-repeats, power intervals, fast pace intervals, etc. There's a lot of info out there on interval training. One of the more common is called HIIT (High Intensity Interval Training). When I train for a Century+ ride, I'm basically doing training rides 4 - 5 days a week with most of them being maybe 2 hour interval training sessions with longer (4 - 6 hour) rides on the weekends. Coming out of the off-season it typically takes 8 - 10 weeks to train for a century type ride, provided that you are already fit; easily longer if you've not done this before. 

All that being said about training, if you were really intensively training before the event; it's conceivable that you over trained and your body was just too spent to make the full effort. It's important to remember that rest days are vital in training for challenging rides.

For Nutrition

Once you've trained well for a long endurance ride, the next key for success is nutrition on the ride. Essentially, you want to consume carbohydrates during the entire ride. Carbohydrates are fuel and without fuel, you WILL bonk.

So, on a supported ride, I make the stops and eat carbs with small amounts of some proteins and fats, plus carry along energy bars. For un-supported rides, I've had very good results using Perpetuem which is a product made by Hammer Nutrition and there are other similar products on the market. This product is primarily maltodextrin plus protein powder plus a bit of fat and some vitamins. (Without getting too in depth, maltodextrin is a polysaccharide consisting of long chains of glucose which is readily used by the body). The beauty of this product is that it's a powder and a large number of calories can be carried in a cycling jersey for mixing into water bottles. Also, on un-supported rides, one can always bring food along and stop at stores along the way. 

Another vital component of endurance riding nutrition is to be sure to stay hydrated and make sure that you consume electrolytes. 

A typical long ride (Century (100mi/161km) to Century+) nutrition plan that I use along with my  riding buddies looks something like this:


Supported leisurely century - We just stop at the rest stops and eat whatever we feel like. 
Supported challenging century - Again, we enjoy the rest stop foods, plus carry along some extra energy bars/other and normally some maltodextrin formula for extra efforts (climbing, headwinds, etc)
Unsupported leisurely century - We bring along various energy foods/bars/endurance sport formulation and typically have lunch at some cafe or whatever along the way.
Unsupported challenging (remote, mountainous, often altitude) century - We rely heavily on endurance sport nutritional formulations, plus bring along a few bars/etc to break up the monotony.


The main point being to consume easily assimilable food (carb/starchy) all along the way. Generally avoiding high fat and high protein foods, as digesting fat/protein 90 miles into a 120 mile ride is usually detrimental to performance and getting over that last mountain pass. 

My answer is based on lots of long distance cycling in the Coast Ranges and Cascade mountains of the Pacific NW and California and learning by trial and bonking...although it's been quite a while since I last bonked... Also, I have been know to extol the virtues of The Time Crunched Cyclist and that's because the training methods in that book completely transformed my long distance cycling abilities. 

BTW - This year I have been working on some DIY formulas for ride energy nutrition. It looks like a roughly 4:1 ratio of maltodextrin:protein powder should work. The raw ingredients are much less expensive than pre-packaged versions.