Pardon me if I talk too much, but...
I think an important part of the story is the CGU. It is a part of the government that investigates corruption. Dilma's government gave a lot of freedom to the CGU and to the Federal Police to investigate corruption crimes.
Many corruption crimes were then discovered. Then, there was this Carwash Operation (Lava Jato), which was basically making corrupt politicians pay for their acts, getting people to trials, legally busting into peoples houses, etc..
In a leaked audio, two politicians talking say that "with Dilma there, it will be impossible to stop the Lava Jato. The easiest is to put Michel Temer there instead".
So, according to this leaked audio, there was a massive scheme, with all houses and the judiciary, to remove Dilma and replace her with her vice-president, Temer.
But they needed an excuse. So they found out that Dilma did fiscal manouvers (nicknamed "pedalada fiscal"). Basically, when Brazil government didn't have the money to pay for social programs (like Bolsa Família, a improved version of the food stamps), she asked the state banks to pay first, and then the government paid back the banks.
According to some, this is not a crime. To others, it is. And to others, it is a crime that legally should lead to an impeachment.
Many politicians asked for Dilma's impeachment process to be opened. But there is this major senator, called Eduardo Cunha. Cunha is from PMDB Party, the party that always supports whoever is in power. (So Dilma is from PT, the Worker's Party.) PMDB and PT were allies. Cunha was an ass, but they were allies. And Cunha, as the speaker of the house (if I'm not mistaken), just didn't accept any impeachment processes.
But everything changed when PT decided to try to remove Cunha from his spot at the Ethics Committee. Then Cunha fired back, and opened the process. The lower house (Câmara dos Deputados) said ay, the Senate said ay, Temer became acting president, some days passed by.
In his first weeks of government, Temer did awful things. One of them was to end the CGU. Anti-Dilma protests called for the end of corruption, and the first thing that Temer did was to end the organ that investigated corruption.
This week was the final trial. Dilma stood there for 10 hours or more making her defense and answering questions, but in the end she got impeached anyway.
And now, probably, the Carwash Operation is over. So are workers rights, public education, public healthcare, and many other things.