Shmuel Ha-Katan would say: Do not rejoice when your enemy falls, And do not let your heart be glad when he stumbles. Lest the Lord see it, and it displease Him, And He turn away His wrath from him.As the commentators point out, this is a direct quote from Proverbs 24:17-18. Why do we need Shmuel Ha-Katan to point out to us what the Bible already does? The commentators all answer that this was a biblical passage that Shmuel Ha-Katan would often quote, and the Mishnah was merely telling us that it was a common saying he adopted from the Bible.
The question remains, though, why Shmuel Ha-Katan would specifically choose this passage as his catchphrase. What about his life led him to that? I think the answer lies in a debate among historians over when he lived. R. Aaron Hyman, in his Toledos Tanna'im Va-Amora'im (vol. 3 p. 1148), argued that Shmuel Ha-Katan was a student of Hillel, which means he lived in the first century BCE. To my knowledge, all historians disagree with this and argue that he lived over a hundred years later, after the destruction of the Temple.
Click here to read moreR. Mattis Kantor (The Jewish Time Line Encyclopedia) places him in the year 76 CE. Prof. Lawrence Schiffman (Who Was A Jew?, p. 55, p. 95 n. 21) explicitly disagrees with R. Hyman. The Gemara (Berakhos 28b) tells us that Shmuel Ha-Katan was tasked with writing the blessing for the Amidah against the heretics. In this context, he was writing against Jews who had adopted Christian beliefs in an attempt to expel them from synagogues and Jewish circles entirely (Schiffman, p. 60). Presumably, they were the people he saw as the enemy. At that same time, Roman persecution of Christians was increasing (link).
It is quite possible that Shmuel Ha-Katan was saying that even when heretics like Jewish Christians suffered -- whether through social ostracism at the hands of mainstream Jews or physical pain at the hands of Romans -- we should not rejoice despite the fact that we prayed for their unhappy endings. Even when heretics who were trying to recruit mainstream Jews to their religion and destroy historical Judaism suffered, we should not rejoice at their downfall. No person's suffering, Shmuel Ha-Katan was saying, no matter how appropriate or deserved -- to the point that we prayed for it, should be celebrated.
For more on this, see my posts about Arafat's death: I, II.
For a very different take on rejoicing at the misfortune of a Jewish enemy, based on the Maharal, see R. Basil Herring's article "Should Jews Rejoice When Their Enemy Falls?" in Tradition 32:2 (Winter 1998): link.