What are the connotations of "Elokim Lo Sekalel"? To whom is it referring?
Rashi (citing Sanhedrin, 66a): It is a dual warning against cursing Hashem and the Dayanim. 1
Ramban #2 (citing Sanhedrin, 66b): It is a warning against cursing Hashem.
Ramban #1 (citing Targum Onkelos), Rashbam, Seforno and Targum Yonasan: It is a warning against cursing the Dayanim. 2
The Tana'im actully afgue in Sanhedrin (Ibid.) as to whether "Elokim" is Chol or Kodesh.
See Ba'al ha'Turim. Ramban and Rashbam: Even if one thinks that he issued a false ruling against oneself, since a person tends to never admit guilt (Seforno). Indeed, the Pasuk mentions Dayanim because it is common practice to curse them, precisely for that reason. See Koheles, 10:20. See also Rashbam.
What are the connotations of "ve'Nasi ... "? To whom is it referring?
Targum Onkelos and Targum Yonasan: It is a warning against cursing an elected leader of the people.
Why does the Torah insert the word "be'Amcha"?
Rashi (in Kedoshim): We learn from the Pasuk there, Vayikra, 19:14 that one may not curse even a Cheresh, and from "be'Amcha Lo Sa'or" the prohibition of cursing anybody else.
Mechilta: Having just learnt the prohibition against cursing a Dayan and a Nasi, "Be'Amcha" comes to include cirsing anybody else in the prohibition.
Yevamos, 22b: To teach us that one is only Chayav if the Nasi is "Oseh Ma'ascha Amcha"
Why does the Torah not write simply "Elokim ve'Nasi Lo Sekalel"?
Mechilta: To teach us that one is Chayav for cursing each independently.
Why does the Torah write "Lo Sekalel" in connection with Elokim and "Lo Sa'or" in connection with the Nasi?
Moshav Zekenim: Even disgrace is considered Kelalah, and one is lashed for it. 1 From Nasi we infer that even if the judge is not a Nasi, one is lashed.
Why is this written after the Mitzvah of returning a security?
Ibn Ezra: If the lender does not return the security, the borrower is prone to want to curse the judge who gave it to him.
The Mechilta learns from the Vov (v'Nasi) that also to a Nasi, even Kelalah is forbidden. Shevu'os 36a says that Kelalah is included in Arur. If so, why did the Torah need to write Arur? - PF)
Moshav Zekenim: Nasi was in the Klal, and left, to teach that anyone who disgraces a Gadol in Yisrael, he is lashed. If he curses a judged, he is lashed for "Lo Sekalel" and "Lo Sa'or."