1)
When is the Tzadik released from his affliction?
1.
Rashi: It is when the Rasha dies. This verse is connected to verse 7.
2.
R. Yonah: Sometimes a decree is made on a Tzadik, and a Rasha is put [to bear it in place of him,] to be a Kaparah for him - "Nasati Kafrecha Mitzrayim" (Yeshayah 43:3). "Kofer la'Tzadik Rasha" (below, 21:18). Shlomo discusses the attributes of the Tzadik, and the detriment of the Rasha, to distance envy of a Rasha's honor, and to disgrace his successes.
3.
Malbim: If a Rasha arranged evil for a Tzadik, the Tzadik is saved from it and the Rasha bears it in place of him, like Haman [was hanged on the scaffold that he prepared for] Mordechai.