My answer is based on my own experiences, as well as those of the people I train with. For completeness, references are at the end.
For endurance training, eat before you train and fast after, for strength training, eat after you train and fast before.
When you train endurance/cardio, you'll need the readily available energy from your meal when you train, so you eat first, then train. When you train for strength, you'll need the proteins and nutrients from the meal for your recovery instead, so you eat afterwards.
Really long answer:
In order to gain energy, the body needs to convert whatever calories you put into it, you already know that. This energy can come from carbs/sugars/glucose, from proteins or from stored fats.
Each of these sources converts to glycogen/energy at a different rate. Sugars go fastest (why endurance athletes tend to carry something with dextrose), proteins go slower, and the process of releasing fat from the stores and converting is the slowest of all.
When there is a demand for energy, the body will choose sugars first, they are easy to convert and the body wants to get rid of them, otherwise it just has to store them as fat anyway.
If the demand for energy is low and the amount of glucose is high (after a big meal your blood sugar spikes), the body will prefer to use that for its energy, since any overload of glucose will eventually have to be converted to fat before it causes damage.
If the demand for energy is low and you have a balanced blood sugar level (why some athletes eat six small meals a day), the body will prefer to use body fats, that is after all what its for. As such, your body will burn most fats while you're sitting on the couch or asleep, as long as your blood sugar is normal. Incidentally, this is where the heart-rate-zones theory come from.
When the demand for energy goes up and your heart rate rises in order to transport more energy, fat burning simply isn't fast enough, and the body resorts to using glucose where available, a small amount of proteins if it has no other choice (not breaking down muscles here, the body has protein reserves) and fat gets left alone.
If you train your endurance/cardio, you will need a lot of readily available energy, and having a meal before you train (on your training days) is most helpful. Otherwise, your body won't be able to keep up (funny enough, your mind will tell you that you're out of energy long before your body actually is). You can then do your fasting day on your resting day.
If you train with heavy weights and low reps, the energy demanded is largely already available as reserves and whatever extra is needed can be converted in time. After your training however, your body goes into repair to fix all those naughty micro-tears and grow your muscles. This takes proteins. So, you eat after your training, a meal with more proteins than carbs, and allow your body to use that meal to repair. You do your fasting day on the day that you train. Keep in mind, it takes some getting used to, training in a fasted state. It enhances your flexibility and doesn't sap your strength. But your own beliefs get in the way, your mind will often tell you that you need to eat first.
As far as how long before or after your training you have your meal, it depends mostly on your body and the composition of the meal, so I can't help you there. For maximum results, experiment. If you can live with less-than-maximum results, it matters less. Your body can adapt to anything as long as you're consistent and build up to it.
Personally, I love doing weights and gymnastics in a fasted state. But if I do cardio, I get this incredible craving all the time. Very annoying.
As for the science behind it:
- Brad Pilon's 'Eat Stop Eat' has a lot of scientific references with regards to the effects of intermittent fasting on exercise. Some really helpful insights there.
- Mark Sisson's 'Primal Blueprint' talks in depth about most of what I wrote above, the process of converting food to energy.
- Finally, for an exploration as to what the body does during extremes, few things beat Timothy Feriss' '4-Hour Body'. This guy injected himself with hormones to see the effects, ate loads of meat to supercharge his testosterone levels and lots of other experiments to figure out what the fastest way was to build his body. Lots of references there on where he got the experiments from. Insane stuff. Really. Don't try it.
PS The above is based on a more tradition day-on-day-off fasting, which lazy people like me prefer. It's the same for the 16-hour, 20-hour, 5:2 etc. forms of intermittent fasting. Just figure out at what time of day to eat and at what time to train. If you do 'Eat Stop Eat', just fast on the first of your double resting days and you shouldn't notice any change in your energy levels during training at all.