Once upon a time movies were all about musical numbers, whether or not the film was an actual musical. Hollywood followed the same maxim then as now: the bigger the spectacle, the bigger the audience. Before special effects blockbusters, the spectacle was song and dance.
While movie musicals have made a comeback in recent years (thanks in large part to Moulin Rouge and Chicago) unless an established performer plays a part, most movies don't rely on musical spectacle anymore. Consider the following exceptions to that rule, ranked chronologically:
A classic film moment by any list-maker's standard: Pre-superstar Tom Cruise clad in tighty whities, knee socks, and sunglasses whaling on that tennis racket, rocking out to Bob Seger's Old Time Rock and Roll. Could this be the precedent for random musical interludes in R-rated comedies?
As Parry follows Lydia through the lunch hour crush at Grand Central Station, sunlight streaming through the windows strikes the brass clock and scatters, creating a moment of restrained surreality. Bathed in disco ball effect, the sea of strangers navigating around each other swirls into a waltz, nuns partnered with businessmen, as they sway to the strains of this original piece by the film's composer, George Fenton.
It's raunchy, it's rude, somebody gets killed with a trident – pretty much what you'd expect from this cast of goofballs. Until, of course, they burst into the pitch-perfect four part harmony of Afternoon Delight by The Starland Vocal Band. Who knew Will Ferrell was a crooner, let alone a jazz flutist?
Carell & company bust a move to the Aquarius/Let the Sun Shine medley from Hair at the end of the movie for no apparent reason. Perhaps the costumed and choreographed homage to the hippie musical is meant to underscore freshly de-virginized Andy Stitzer's own sexual revolution (in his pants).
Becky teaching Dante to dance on the roof at Mooby's: par for the course in a Kevin Smith film. Jay and Silent Bob head-bopping and lip-syncing to ABC by The Jackson Five: silly and hilarious, but again, not outrageous for Mr. Smith. Gap ad dancers in the parking lot: priceless. It speaks volumes about the man's style (and certainly his audience) when it's more bizarre to see a musical number than a donkey show.
The list specifies that the musical numbers are impromptu and therefore completely unexpected; nobody's in a band or used to be in a band or wants to be in a band (or else the Tiny Dancer sing-along from Almost Famous would be prominently featured). They're not training for a dance recital or high school/Broadway musical or karaoke contest, they're just regular joes who spontaneously burst into song and/or dance.
There are certainly other movies that qualify: Thirteen Going on Thirty ranks with both a Thriller dance-along and Love is a Battlefield lip-sync sleepover; in 10 Things I Hate About You, Heath Ledger romances the prickly Julia Stiles with You're Just Too Good to Be True; and John Michael Higgins' steals every scene with his superb a capella stylings in The Break-Up. The list could go on and on...