Last weekend, my wife took our two children (almost 3 and 14 months) to the museum. They go there frequently (5-10 times in the last six months), and usually have no problems.
This time, the older one was a bit more tired than expected, and didn't do a very good job staying close to mommy. He twice went off to do something where she couldn't see him for thirty seconds or so, and while she knew where he was generally, obviously this isn't a good idea. The second time, she made it clear to him he would have to leave if it occurred again; which it did about a half hour later.
Unsurprisingly, as he was misbehaving likely due to tiredness, he threw a huge fit leaving, had to be physically restrained and hit/bit several times on the way out. This is normally challenging, even more so given there was also a 14 month old in tow.
Obviously, the first best answer for how to avoid this is simple: figure out when he's getting tired, and leave then rather than later. However, given sometimes we're going to get that wrong, what good solutions are there for extraction? This isn't a normal extraction, ie, leaving at closing or a designated time; this is when he's specifically crossed a line that means we have to leave now - so no "two minutes" or timers, which usually work very well. We'd rather not use physical restraint - it makes things worse, as it did here - but we don't entirely know what else to do. In quieter areas I might head towards the exit and expect him to follow (which usually works), but in a somewhat crowded museum that seems dangerous (and likely to hurt his feelings, as well).