Who were the "leaders of the people"? What was Moshe expected to do with them?
Rashi and Targum Yonasan: The "leaders of the people" refers to the Dayanim, whom Moshe was to instruct (to take verbally) to judge all those who worshipped Ba'al Pe'or. 1
What is the meaning of "Vehoka"?
Rashi #1 and Rashbam: It is Lashon of hanging (or killing
Rashi (Ibid.) or breaking the connection, since words often have opposite meanings.
Whom did they hang and why?
And what is meant by "Neged ha'Shemesh"
Rashi #1: It means that they were to hang them publicly, for all to see.
Rashi #2: The Dayanim discovered who the sinners were by means of the sun which shone its rays on them. 1
Seforno: So that the people should see them being hanged and not object
Rashi: After the Ananei Kavod moved away from above their heads.