Racing distances of 16+ miles, or 2 or more hours running time, places a different demand on the body than shorter distances. Simply put, the body has to switch from burning carbohydrates to burning fats. When this switch happens is when you start experiencing the run as starting to be a bit harder. If you have not trained well for this distance/time, then this is when you 'hit the wall'. However, if you train by doing lots of LONG runs (of 16+ miles), then your body starts to adapt and make the transition from carbs to fat smoother. This means that it might not start feeling so tough in the marathon till 20-22 miles - but it still feels tough!
That is the physiology (sort of). However, the psychology is equally important. You need to be able to expect things to get harder/painful during a long run and be able to deal with this. How you do this will vary between people. It might include singing to yourself, loosing yourself in the crowd of the race, counting steps, telling yourself positive mantras etc. It is just as important to develop these types of psychological skills and strength in your training, as for your body developing its ability to switch from burning carbs to fats. This means that your long training runs need to stress you both physically and mentally.
This last point is where I can get into a mess at times. I will often have work to do at the weekends. The problem is that if I do a 20+ mile run in the morning, I am so physically knackered afterwards that I struggle to do anything, including work. So there is a temptation to do some work first before going out for a run. However, on several occasions this has led to problems of me cutting the run short. I think that the problem is that you really need to have 'got your head around' a long run before setting off, even in training. You need to have 'focus' and be up for the task at hand, which will be physically and mentally challenging. Personally I find that I need an hour or two to clear my head of other stuff and to think about the run ahead, and be able to get into a positive frame of mind about it. I need to be 'up for the challenge' and relishing it. This gives me the mental strength to be able to meet the psychological challenges. I would repeat that if there is no psychological challenge, then you are not getting the maximum benefit from the run. I think this is VERY different from just going out for a 6 or 7 mile run (even a hard one), where you can step out of the door straight from work and use the run to clear your mind. The psychological demands are very different for this type of run compared with a long run.
I am sure that some of you will wonder what all the fuss is about, that you are able to do a long run at the drop of a hat without having to think about it first. You are the lucky ones. For the rest of us, I think this is an element of training for marathon type distances that needs so thought.