The quit is usually a fueling or pacing problem in disguise
Most DNFs trace back to a small set of preventable things: nutrition and hydration failures, GI distress, going out too fast, missed cutoffs, and weather, with the mental crisis riding on top. When your stomach is empty or you blew up early, your brain hands you a very convincing case for stopping. That is why the low-point protocol starts with food and fluid, not a pep talk. Fix the body and the mind usually follows.
One more thing helps in the moment: everyone out there feels as bad as you do, or worse. The discomfort is the event, not a sign something has gone uniquely wrong for you. And if you picture explaining your drop to the people who watched you train, "I just did not feel like it anymore" tends to fall apart the second you say it out loud.