Voters in Hungary, Brazil and Serbia ousted authoritarian leaders this year, suggesting democracy may be regaining ground.