TT #270 · Parashas Shoftim · Sixth Aliyah · Passuk 19:20
And those who remain shall hear and fear, and shall not continue to do any more such evil thing in your midst.
Torah Temimah points to Sifrei Devarim 190 / Sanhedrin.
TT lemma: וְהַנִּשְׁאָרִים יִשְׁמְעוּ וְיִרָאוּ.
Sefaria — Sifrei Devarim 190 / Sanhedrin
English: ‘And those who remain shall hear and fear’ – from here that a public proclamation is required.
Derash on deterrence (Sifrei) — the hearing and fearing imply public knowledge of the verdict.
The punishment of conspiring witnesses is carried out in a way that the public hears and fears, so that such evil is not repeated.