If you hated it from start to finish why did you carry on? I'm being hypocritical here as know I've stuck pig-headedly at a race when I was miserable the whole time but there's nothing to be gained from it. Perhaps next time stop, assess the situation, and have a think about what you want to get out of the race?
I didn't retire as I think I was just hoping my run would eventually get better. Looking back on it I wish i did retire as i wouldn't have wrenched my groin but the spectator control was so close to the finish that once i got there i just ploughed on.