There's a powerful current in the academic study of law, represented in political science most notably by Barry Weingast, that hopes to analyse law in terms of game theory. The basic idea of the approach is to represent conformance with the law as an equilibrium outcome in a coordination game. In a coordination game, the players all attain a better outcome if they can coordinate their moves than if they act based on the assumption of no coordination. For instance, if we're choosing what side of the road to drive on, it would be a lot safer if we all chose the same side.
Weingast and various collaborators have posed the relevant coordination problem as a problem of coordinating on decentralised enforcement. If everyone plays their part in punishing those who breach rules, then the rules will be followed. In a recent paper, Hadfield and Weingast suggest that the key role of law is coordinating beliefs on when a breach of law requiring decentralised enforcement has taken place. They then argue that "the normatively attractive features of the rule of law—generality, stability, impersonal application, publicity—are attributes needed to support decentralized enforcement efforts."
The ladder of reasoning ascending to this conclusion is missing more than a few rungs, in my view. But the more important point is how bizarre it is to assume that only decentralised enforcement provides a stable basis for legal order. And this really does seem to be what they think:
Yes, some parts of legal order look like coordination games, but many others do not. Consider the considerations that go into deciding whether to obey the law about which side of the road to drive on...The [mistaken] idea that government coercion is necessary for law leads to two other mistakes: (a) the belief that legal order can be achieved by tightening up government coercion; and (b) attributing failures of legal order to failures of coercive institutions, the power of the judiciary, or the enforcement agency in particular.
versus deciding whether or not to exceed the speed limit:
In the speed limit case, tightening up government coercion (speed cameras, points on the licence) certainly makes a difference to a balance of considerations; in the what-side-of-the-road case government coercion almost irrelevant--this really is a coordination game. One could multiply examples ad infinitum. Again: there are examples of law-backed order that are coordination games and there are others that are not.
Given how smart these scholars are, it's pretty hard to understand why they don't see this. The only explanation I can offer is the impulse, all too frequent in political science, to come up with a maximally general theory. But the assumption that there's a single answer as to why people obey rules is just wrong (and more here).
For an alternative approach to the rule of law, see here.