This is a great question, really good. Basically, IMHO, is it OK to quit? Absolutely. I will argue it takes more courage to walk off the course when it is appropriate than to suffer through a terrible race when you may do real physical damage. I don;t want to offend anybody here, and please keep my comments in context, but I frequently wonder about the motives of some people who go to long events such as Ironman poorly prepared and just drag through it to say they finished. While I respect that they may see some value in that, I do not see as much value as if they had made a plan a year earlier, stuck to it, put together their best race and followed through. I have a lot of respect for that.
When should you quit? Tough to say, it is an individual question. I have entered a couple events when I did tell myself before the start of the event “There are only two ways out of this race for me: Across the finish line or in a bag.” They were make or break races that were important to my life. They stood for more to me than just the event themselves.
In general if I am in a race and I perceive that I am doing serious, potentially permanent physical harm that I am not willing to live with I will quit. Live to fight another day. They have the ssame events every year. You just come back the next year to kick its ass. It is important to keep things in perspective. Think of Everest climbers who spend years training and $100K to get to the summit (regardless of your opinion of the sport) and have the courage and judgement to turn around 300 meters below the summit. Few people have that degree of temperance and humility.
Remember that when you ijure yourself or put yourself in personal danger it not only affects you but the people who love you. That can become an issue too, especially if you get injured and they are stuck taking care of you.
And finally, one last thought: The “danger” in quitting is you can make it into a habit. Once you quit one race or one tough training ride it becomes easier to do. It is like divorce, once you do it once it it much easier to do it the second time. It becomes a tooll you use to cope with specific circumstances. The lines between what is acceptable and not acceptable begin to blur or shift. That can be bad. Remember that much of the value of endurance sports in pushing through our own perceptions of our limitations and discovering we are capable of much more than we thought. That can require a stretch on occasion, and it can be an uncomfortable stretch. It comes with the territory. If it was easy, everyone would do it.
I always remember this quote, my “words to live by”. It says it all:
“The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood; who strives valiantly; who errs and comes up short again and again, who knows the great enthusiasms, the great devotions, and spends himself in a worthy cause. Who at best, knows the triumph of high acheivement, and who, at worst if he fails- at least fails while daring greatly, so this his place shall never be with those cold and timid soles who know neither victory nor defeat.”