In this chapter, Moses explains how to judge crimes and laws governing the future kingdom.
This chapter has three main sections. The first section, v. 2-7, is a discussion of how to prosecute accusations of idolatry. This is very similar to prior legal procedures, such as Num 35:30 (requirement for more than one witness), Deut 13:10 (penalty of death for serving other gods), Deut 13:14 (investigate crimes carefully).
Overall, the language is very Deuteronomic. In particular, the emphasis on careful investigation is reminiscent of Deut 13. I skimmed through some of the legal sections in Exodus through Numbers and it is very terse and factual, simply stating what is disallowed. Deuteronomy seems to be more procedural, both stating what is disallowed and also how that act is to be prosecuted.
Some examples. Ex 22:20. It only states the act (sacrificing to other gods) and the punishment (shall be destroyed). This chapter, by contrast, also lists the requirement for witnesses and careful investigation and lots of descriptive text. Ex 23:13 is very similar. Lev 19. This chapter lists many laws about many topics, but most of them are stated tersely with no procedure for investigating offenses. Many of them also do not list a punishment.
The most common punishment before Deuteronomy is being "cut off", which is a great example of what I mean. It is an enigmatic (to us), short phrase referring to some form of punishment, and it is only used this way in Exodus through Numbers. In Deuteronomy and afterwards, the phrase is used to refer to other things, but not to the punishment of a specific crime. Deuteronomy, on the other hand, uses more specific punishment like stoning (v. 5), also with more procedural text ("the hand of the witnesses shall be first", everyone else follows).
The second section, v. 8-13, is another legal section, but it doesn't directly relate to the first section. The first section was specifically regarding apostasy, while the second section deals with any kind of crime (v. 8). This section has two principles, that the priest can decide issues "too hard to decide" and that the "man who acts presumptuously by disobeying the priest must die. The obvious effect is to empower the priests as the ultimate judges of the nation. It's interesting that it also states a punishment for those who disobey the priests, as if the text is anticipating some resistance to their authority. Of course, anyone who disobeys the first law will also disobey the second, so if the people at large disobey then it won't have any effect.
The third section is provisions for the kingship. I believe this is the first reference to a king in Israel, except for possibly a veiled reference in Ex 19:6, though in that case it was likely referring to Israel as a kingdom under the LORD's rulership. Here it is clearly referring to a human king, "like all the nations who are around me". This is slightly negative because the past reference to "the nations around me" was Deut 12:30: "How do these nations serve their gods, that I also may do likewise?" It is describing a pressure on the Israelites to conform to the standards of the nations that live around them. This pressure influences Israel in many ways and they succumb to it in many ways. This is the corollary of the "principle of separation" I talk about so much because Moses is (unsuccessfully) trying to keep the Israelites away from this pressure.
Anyway, as this chapter implies, the Israelites will later choose a king and Moses does not actually prohibit it, in spite of the similarities between this passage and Deut 12. So in general, I think this passage is a hesitant permission. There's a risk that Israel will fall down a "slippery slope" towards idolatry, but the kingship isn't really a factor one way or the other.
However, the LORD is meant to be a king for Israel (cf. Ex 19:6), so whatever king is placed over Israel must not take precedence over their allegiance to the LORD. In ancient days, it was normal for some kings to serve other kings (cf. Gen 14 where Chedorlaomer is clearly superior to the other kings fighting with him), so it isn't necessarily a problem for Israel to have a king, who in turn serves the LORD. It's only a problem when that king replaces the LORD and the people look to that king to protect and guide them rather than the LORD.
This section orders the future king to not "multiply" horses, wives or gold, "or else his heart will turn away". Horses in this case are a critical part of the military force. The might of Egypt was in their chariots (for instance, Ex 14:7) and interestingly the LORD is commanding the Israelites to not build a powerful military. It's also surprising that the people would "return to Egypt to multiply horses"; I'm not sure why they would do that. Maybe it means buying horses from Egypt? I'm not sure.
Also, the constraints against multiplying wives and gold both are about limiting the power of the king for three reasons. 1) that the king might not "compete" with the LORD like I described above, 2) to maintain a balance of power between the priests and the king, so that the king cannot monopolize power and take over the nation, 3) to prevent the king from becoming prideful at his great power. A big part of limiting power in Israel is to keep the people dependent on the LORD. In later Israelite history, we also see the nations that rule Israel takes steps to limit their future power. In that case, it is done with malice, to keep the Israelites weak and helpless. In this case, the LORD wishes to keep Israel weak that he might protect them.
The last part of this chapter is the religious requirement on the king. The first part is a set of constraints on his power, the second part is a requirement that the king write himself a copy of the law "in the presence of the Levitical priests" and read it for the rest of his life, and again the intent is to keep the king away from pride. I mention the "Levitical priests" because I think this is intended as a restriction on the power of the king, keeping his power under the covenant that is primarily mediated through the priests. The king is allowed to be a physical power in Israel, but that power is always kept under the authority of the LORD, delegated through the priests.
One last point. In the broader narrative of Deuteronomy, this chapter most likely corresponds to the fifth commandment, to honor one's father and mother. It's not an obvious parallel, but there is some relation between parents as authority figures and the authority of the priest (second section) and king (third section). That's how some commentators tie them together. I'm a bit skeptical myself, but I wouldn't reject it without further research.