Haley Joel Osment, with Bruce Willis at right, was a major reason “The Sixth Sense” still resonates 20 years later.
BUENA VISTA PICTURES Haley Joel Osment, with Bruce Willis at right, was a major reason “The Sixth Sense” still resonates 20 years later.

Gary Thompson, The Philadelphia Inquirer

“The Sixth Sense”, which is celebrating its 20th anniversary, opens with a shot of a burning lightbulb, which is as good a metaphor as any for a guy with a bright idea.

The guy is M. Night Shyalaman. In the late 1990s, he was coming off the box-office disappointment of his sophomore feature, “Wide Awake” — starring Rosie O’Donnell as a Phillies-loving nun — which was mangled by Miramax and a pre-scandal Harvey Weinstein, already a notorious bully. The story goes that Shyamalan was so wounded by the experience, he sat down to write an I’ll-show-you script for the ages, and unlike the million other people who sat in front of a word processor with that same vow, he actually did it.

His various drafts evolved into a story about a troubled boy (Haley Joel Osment) who purports to see ghosts and is visited by a psychiatrist (Bruce Willis, with hair). Then, midway through the writing process Shyamalan reportedly hit upon the genius idea — spoiler alert for a 20-year-old movie here — to make the psychiatrist Malcolm one of the ghosts young Cole sees — a surprise he would spring on the audience at movie’s end.

And he did, making “The Sixth Sense” the great out-of-nowhere box-office phenomenon of 1999 — when the internet was still new enough that there was not yet a critical mass of trolls to spoil its surprise, and the audience could participate in the shared community exercise of preserving its secrets.

The movie starred Willis, plus an unknown (to American audiences anyway) Australian actress named Toni Collette (who would serve notice in the film that she’d become the greatest screen weeper of her generation), and, oh yeah, the city of Philadelphia, which looks beautiful and richly historic, the kind of venerable city old enough to be plausibly haunted.

To watch the movie today is to reaffirm how smartly made it was, and how influential it has become to a generation of suspense and horror movies following it. Jordan Peele is an acknowledged fan.

Shyamalan, in “The Sixth Sense,” was using Easter eggs before anybody called them that. The movie is full of patterns and clues and repeating motifs, many of which accent or explain the story in ways that reveal themselves on subsequent viewing — red knobs, red sweaters, red dresses, red nail polish, red balloons, red bedspreads, often used to foreshadow the presence or appearance of a ghost.

Other patterns emerge. The fleur-de-lis pattern in the church matches some of the designs we see in Cole’s home — his other place of refuge. Cole has the same derogatory nickname (freak) as the young man (Donnie Wahlberg) who shoots Malcolm at the movie’s outset. Even when Malcolm tells Cole a story of losing his lunch during high school, it foreshadows the key scene at the end of the movie in which Cole finds his calling as a mediator between the corporeal and spirit worlds.

It’s fun to watch the movie from a 20-year distance, to see how Shyamalan both hinted at and concealed his Big Reveal. It’s obvious on repeat viewing that Cole immediately sees Malcolm as a ghost: He initially runs from him, fears him, hides in a church and slowly warms up to Malcolm as he realizes the shrink is sincerely trying to help — and, later, that he can be helped.

Watching “The Sixth Sense” is a bit like rewatching “Fight Club” just to see how David Fincher handled the challenge of a character who isn’t really there. In fact, looking back, it’s a mini-miracle that “The Sixth Sense” and “Fight Club” could be released within months of each other and coexist in a spoiler-free universe.