How autocracies endure — and end