Why does the city rejoice over the Tzadik's good?
R. Yonah #1: The Tzadik benefits everyone, and does not harm.
R. Yonah #2: The verse commands everyone to rejoice over the Tzadik's good and the Rasha's demise. Even though it says "Lo Sisna Es Achicha bi'Lvavecha" (Vayikra 19:17), a Rasha is not Achicha. Similarly, "v'Nasi v'Amecha Lo Sa'or" (Shemos 22:27) applies to one who does the deeds of Amecha (but not to a Rasha) (Yevamos 22b).
Malbim: Tzadikim do Tzedek in action. The city receives good from them.
What do we learn from "uva'Avod Resha'im Rinah"?
Sanhedrin 37b: Witnesses in a capital case should not say 'why should we be liable for his blood?' There will not be retribution [for causing his execution].
Sanhedrin 113b: When a Rasha leaves the world, good comes to the world.
Malbim: The city rejoices over Resha'im's demise, for they do evil in action.
Does Hashem rejoice over the demise of Resha'im?
Sanhedrin 39b #1: No. "B'Tzeis Lifnei ha'Chalutz v'Omrim Hodu la'Shem Ki l'Olam Chasdo" - it does not say "Ki Tov", because Hashem is not happy with the downfall of Resha'im.
Sanhedrin 39b #2: "V'Lo Karav Zeh El Zeh Kol ha'Laylah" - the angels wanted to sing in front of Hashem on the night of Kri'as Yam Suf. He said, My creations are drowning in the sea, and you want to sing in front of Me?! Hashem is not happy, but he makes others rejoice. "Yasis" (Devarim 28:63 - He will make our enemies rejoice over our downfall); it does not say 'Yasos' (He will rejoice).