Ex (first case): In Ruthless People, they walk into a store to play a VHS tape on a VCR. They don't know (but we do) that the tape contains embarrassing scenes, which are about to be displayed to the whole store.
Another example of first case: In Asterix, whenever the Pirate Ship appears. We know (and they know) they're about to get trounced.
With the Three Stooges, we know he's going to smack him upside the head, the question is just how's he going to do it this time?
Catchphrases are a classic example of this, but it's everywhere. I once wrote a pretty terrible sketch where Sean Connery kept saying 'schlap' over and over. By the end of it, there was a sentence where it was obviously, blatantly, absolutely going to end in the word 'schlap'. You could /feel/ the the audience hang on that expectation, and when it inevitably hit, they lost their minds. Zero surprise. Zero subversion of expectation. Brought the house down.
"Benign violation" is the only generalization that I have found comes close to being true. Why did that line land even though it was no surprise? Because while it didn't violate expectations, it violated a lot of other norms (mockery, incorrect pronunciation, domestic abuse). And in fact, the more predictable it got, the funnier it got, because it simply became absurd that it was being uttered so frequently.
In any case, I have literally never been able to write anything funny from first principles like "surprise" or "benign violation". If you try, you ironically put yourself in the mindstate opposite to the nature of those terms. You actually need to forget the principles, to let go and be free, to reach anything that fits the principles.