Why does Beis Din not punish lying witnesses who succeed in getting someone killed with their false testimony?
(16,18) “Judges and officers you shall place for yourself in all of your gates which Hashem your G-d gives to you for your tribes, and they shall judge the people a righteous judgement.”
The midrash brings the teaching of R. Eliezer who said: When there is justice there is no justice, and when there is no justice there is justice. The midrash asks: How can this be? It clarifies that R. Eliezer means that if justice is done below then justice is not done above, and if justice is not done below then justice is done above.
We can explain this midrash according to the law that if false witnesses succeed in getting the accused killed with their false testimony, they are not killed. The reason for this is because now their punishment is handed over to Heaven and not to Beis Din.
This is what the midrash means: When there is justice - when justice was carried out and the accused has already been killed, there is no justice - the false witnesses are not killed. And when there is no justice - when justice has not yet been carried out because the accused has not yet been killed, there is justice - the false witnesses are killed.
The midrash asks: How can this be so? On the contrary, if the false witnesses have succeeded in getting an innocent man killed then all the more so should they be killed!
Therefore, it clarifies that R. Eliezer means that if justice is done below - if the witnesses are proven to be false before carrying out the death sentence of the accused and thus true justice was done, then there is no justice above - justice is not handed over to Heaven because Beis Din kills the false witnesses. And if justice is not done below - if an injustice is done and the accused is wrongly executed, then there is justice above - the just punishment of the false witnesses is handed over to Heaven.