Q. I have a number of questions in regards to elections according to Halacha. 1) Firstly, what if any is the source in the Torah for having a government?

A. The Netziv (Haemek Dovor – Bereshis 9: 7) explains that the commandment of “P’ru Urbu” (Be fruitful and multiply) said to Noach, incorporates in the word “Urbu” an expression of grandness and rule, necessary for humans to survive as a viable lawful society.
Others maintain that the source for establishing a government is the mitzva of “Shoftim Veshotrim” (You shall set up judges and law enforcement officials for yourself in all your cities – Devarim 16: 18). They maintain that it stands as a separate mitzva, given even before they could name a king. (See Rambam – H. Deos 2: 3, Sanhedrin 25a in regards to naming a Parness, Teshuvo Meahavo 1: 208).
Maharitz (Teshuvos Chadoshos 133) asserts that the need for the rule of a government stems from Moshe Rabbenu’s plea; “Let Hashem, the G-d of spirits of all flesh, appoint a man over the congregation… so that the congregation… will not be like sheep without a shepherd.”
Teshuvos Vehanhogos (3: 431) maintains that government rule it is basically a rabbinical commandment.

Rabbi A. Bartfeld as revised by Horav Shlomo Miller Shlit”a