Why did Brazil elect Jair Bolsonaro?

The country just elected a new president known for his far-right and conservative views, and controversial, racist, homophobic, and sexist statements. But what made the country of Samba, Carnaval, and Futebol do such a thing?

“The Economist” cover from September