Most of the time, movies pay special attention to keeping their internal reality consistent - they know it's all fake and we know its all fake but we're just engaged in a suspension of disbelief to go along with what's happening for the next 90 minutes or so.
Taken objectively, it's all a bit nuts but no more so than what we do while engaging with a play or being swallowed up by most forms of entertainment. But quite naturally there are works that break that pact, addressing the audience directly and breaking the fourth wall - a stage term used when the players give a shout out to the viewers in the dark.
You migh think it's a relatively rare thing, with the most recent example being Marvel's Deadpool, but this lengthy supercut will educate you otherwise. There are plenty of popular choices here with more obscure options too. Woody Allen, John Landis and Mike Myers all have made a habit of it throughout their careers.
Check it out and see how many you can name.