Let me mention Graham Allison and Philip Zelikow's excellent book Essence of Decision: Explaining the Cuban Missile Crisis (2nd ed. 1999) here. The thesis of the book is that it's often a bad idea to try to understand the actions of countries by treating them as rational actors, and it illustrates it by three takes on the Cuban missile crisis.
In the first chapter it uses the rational actor model and asks about each event "what was the Soviet Union trying to do here". It turns out to be extremely puzzling: for instance they shot down a recognizance plane in the last few days when they seemingly could not gain anything by such a provocation, they were extremely inconsistent with their camoflage (did they want to be discovered?), and they had weird reloading arrangements (seemingly signalling that they intended the missiles to be used for a first strike).
Then in the next two chapters, the book dissolves these mysteries by instead considering the actions as flowing from different institutions or individual decision-makers within the Soviet Union. For instance, two different organizations were involved in managing camouflage, and the reloading arrangements were standard operating procedure for the Rocket Forces (and made sense for continental sites). And the U2 shoot-down? Well, the air defense forces had standing orders to shoot down American planes, but they were not able to get their radar system up and running until the last day of the crisis...
My theory on why North Korea has stepped up its provocation of South Korea since their nuclear missle tests is that they see this as a tug-of-war.
Suppose that North Korea wants to keep its nuclear weapons program. If they hadn't sunk a ship and bombed a city, world leaders would currently be pressuring North Korea to stop making nuclear weapons. Instead, they're pressuring North Korea to stop doing something (make provocative attacks) that North Korea doesn't really want to do anyway. And when North Korea (temporarily) stops attacking South Korea, everybody can go home and say they "did something about North Korea". And North Korea can keep on making nukes.