In my mind, there are two issues involved in surrendering. (I am speaking of FFAs.)
1) My enjoyment of the game.
2) Politeness/fairness to other players.
What I mean by (2) is that in some games, surrendering is sometimes giving a victory to another player (one of the ones closest to you) because they will gobble up all your cities and then take down the rest of the people.
So when does the lack of enjoyment outweigh fairness to other players? Usually, I try to stay in as long as possible, but sometimes, I get to the point where I'm not looking forward to the game, so I think about surrendering.* I just quit a game well before I should have, in terms of the politeness factor, and I feel bad about that now.
(I don't usually quit because of a bad early battle or losing a hero early or something.)
What do other people do?
*I kind of wish there were a mode of surrendering that allowed your cities to continue producing, until you ran out of money. So it isn't a complete surrender.