Take a deep breath, because we're about to get technical for a second. Ready? Go.
There are at least two different types of laws in Deuteronomy: apodictic and casuistic. Wait, don't freak out. We're about to explain. Apodictic laws are pretty obvious and common-sense friendly like, say, "Thou shalt not kill." Casuistic laws, on the other hand, are based on actual cases. That means some event had to occur that demanded the creation of the law. Example: the Internet was invented, and suddenly we need laws about music piracy.
But things get messy sometimes. "Thou shalt not kill" seems simple enough, but what happens in cases of war or self-defense? Law is just never easy and the contradictions are everywhere in Deuteronomy.