There are several ways to end the game. For example, you can simply close the browser - this way you will still remain in the game for a while, but if you don't re-enter within 10 minutes, you will quit and lose all earned SP. The same happens if you click 'Exit to lobby' in the main menu.
If you feel that continuing the resistance is pointless or decided to quit for whatever reason, you can choose 'Surrender' from the main menu - this way you will be able to save half of your earned SP.
Still, the best way to end the game is to win it. You can do it by either eliminating all opponents or by fulfilling the Victory condition. A joint victory / draw is also possible, if all remaining players are in alliance.
Victory conditions can be set in the game setting.
Total Annihilation means the game will only end when only one player (or a group of allied players) is left.
Capture the homecountry/homecity means that to destroy your opponent it would be enough to capture his homecountry or its capital.
Capture the UK means that the player who first takes control of the UK wins.
In advanced game settings you can also set game duration (default is 50 turns). If by this time there's no winner, a player with the most SP (earned during the game) wins.