We do not hit it on the head. Students do not misbehave randomly. They do so for particular reasons, which are neither mysterious nor psychologically impenetrable. The reasons area rather evident and most of the problems can be eliminated, modified, or avoided by teachers in the classroom whose dispositions allow it. Some students like to probe at existing boundaries to see how far they can push and what they can get away with.
Students mimic each other, especially when disapproved behavior is involved.
From time to time, students will be intensely curious about or interested in something, so strongly that they disregard teacher directions. Most students crave attention and if necessary will misbehave to get it. Most students want power, especially in matters that affect themselves. They often defy the teacher to prove they have power. When students become bored or frustrated, they will disengage from assigned tasks and look for more interesting things to do, often things that are disapproved.