The Rambam brings the Midrash Sifri on Deuteronomy (17, 16) "שׂוֹם תָּשִׂים עָלֶיךָ מֶלֶךְ" that says: "A king and not a queen", and writes that a woman cannot be appointed to be "king".
Regarding the heritage rules:
When a king dies, his son will rule under him (see Gemara, Kritut, 5), as outlined in Deuteronomy (17, 20):
לְמַעַן יַאֲרִיךְ יָמִים עַל מַמְלַכְתּוֹ הוּא וּבָנָיו בְּקֶרֶב יִשְׂרָאֵל
If he has several sons, the oldest will succeed. If his son is a Katan, the throne "waits" for him to come of age. If he has no sons, the same rules that apply to heritage priority detailed in Bamidbar (chapter 27) will be considered.
A succedding son must be Yerei Shamaim (observant) in order to be worthy of taking over the throne.