Students standing up to leave at the sound of the school bell is a conditioned response. They have learned that when that bell rings, they are able to leave the classroom and have some free time, which is very reinforcing for most students. This response ends up backfiring on the teacher if they need the students to stay a few minutes late. That conditioned response is so strong that the students will struggle to stay seated and calm. They will also struggle to learn during that time, because they are using a lot of mental energy to fight the conditioned response.
Conditioned responses can be changed. One way is by providing an even stronger reinforcer. If the class is playing a fun game and the bell rings before they can finish, students are much more likely to stay behind and ignore the bell in order to continue playing the game. In a different scenario, teacher could tell the class that they will pass out candy as soon as the lesson is finished as a reward for remaining after class. The students that like candy stay behind in order to get that reward.
Alternately, the teacher could use a form of punishment. What do you think the students would do if, as soon as the bell rings, the teacher tells them that any student who does not remain to finish the lesson will get extra homework that evening? Some students will decide that they do not want the extra homework and stay seated. This group of students will likely still struggle to stay still and on task during this time, because the desire to leave is still there—they’re too focused on listening for the OK to leave to learn! For other students, this threat may not outweigh the reinforcement of leaving at all. They hardly even consider the extra homework because they do strongly want to leave. Later when they actually have to complete the punishment homework, how do you think they are feeling? Odds are, they’re cursing the teacher for assigning the homework, rather than themselves for leaving early and earning extra homework as a consequence. This emotional response can actually increase the students’ desire to leave at the bell in order to get away from the mean teacher that assigns extra homework.
Punishment CAN work; however, because it teaches the learner what NOT to do rather than what they SHOULD do, it is much more likely to increase different behaviors or cause new behaviors to be selected in response, which are not always beneficial to the teacher. While studies are still being done on the negatives and fallouts of using positive punishment, one thing is for sure: positive reinforcement, when used correctly, is incredibly effective at changing the underlying emotions behind conditioned responses. The students who were reinforced saw staying after the bell as fun! The students who were punished still see staying after the bell as boring or undesirable, but they learned that leaving at the bell (when risk of a punisher is present) is even worse.