Technically, the victory condition is to destroy all of your opponent's buildings, but as in chess, it's the norm in SC2 to resign from a game when there's no remaining chance of winning. Intentionally prolonging an already-lost game is considered a quite rude thing to do.