I resign when I think the game is not salvageable anymore. It'll depend on my opponent's playing strength whether I would (futilely) continue in a lost position for a while or resign already.
The decision to resign is entirely up to yourself. If you think you can still save a draw or even a win, you should play on. If you think you can learn from your opponent playing the game out till mate, you should play on. But if neither of these options apply, playing on is a waste of time.
Resigning
I notice the lower rated players here play until they are checkmated. As an intermediate player, I find that playing a game that is lost, deters me from playing my other games effectively. My remedy is to resign games I lost. Playing a game that is lost is like not repenting a burdoned problem. (Don't mix this with religion) But, this allows me to play the rest of my games better and with a more clear mind.
When is an appropriate time to resign? Why do you resign? Should you ever resign? I say you should make a person prove they see what you see before resigning.(eg. If you see they can do checkmate, make them prove the see the mate)