The Sixth Sensecelebrating its 20th anniversary with a special Film Center 35mm screening at 7 p.m. Tuesday — opens with the 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 (who will attend the screening at the Film Center, 1412 Chestnut St.) and field questions). 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 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 were 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, an unknown (to American audiences) 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.

Both movie were hits, but The Sixth Sense grew into a monster — opening at $26 million its first weekend on Aug. 6, building and holding its audience to an astounding degree, week after week after week. Subsequent weekends registered at $25 million, $23 million, $20 million, then back up to $22 million. Unheard of. The Sixth Sense was one of the last great word-of-mouth movies of the pre-Marvel, pre-blockbuster era, when movies were allowed to marinate in theaters and build an audience, which means it may well be one of the last great word-of-mouth hits ever made.

That big rug-pull of an ending is surely part of the movie’s success, but there’s more to it than that. We are completely invested in the emotional core of the story — Cole’s fear of being honest about his visions, and thus losing his mother (“She doesn’t look at me the way everybody else does, and I don’t want her to”). That’s why the scene in the car when he divulges his secret is so riveting; there’s so much on the line, and it’s so well-acted by Osment and Collette. And it’s because we naturally think the movie is over when that decisive conflict is resolved, that we are blindsided by the late-game revelation of Malcolm realizing he’s dead.

Looking back, we can’t be surprised that the movie benefits from the performances of Willis, or Collette, or the underrated Olivia Williams (Rushmore, An Education). But it’s a bit shocking to see how much The Sixth Sense relies on the performance of young Osment. He has a prodigious amount of screen time, is asked to carry a great deal of emotional weight, and he’s so freaking good.

You don’t see better performances by an actor that age. I remember Willis saying so 20 years ago, when I interviewed him. To paraphrase: This kid can only give this performance once. He will grow, he will change, he will be a different person and different actor, and it’s amazing that when called upon, he did it perfectly.

There is something chilling, still, about seeing Osment as little Cole, peering over the covers of his bed, telling Malcolm, finally, that he sees dead people – all the time, “walking around like regular people.”

And here is another element that feels more pronounced in retrospect: Shyamalan’s suggestion that people can be physically dead or spiritually dead.

As Cole puts it: “They don’t know they’re dead. They don’t see each other. They see what they want to see.”

Like regular people.

The lines have a creepy resonance that reaches across the years, and contribute to the movie’s own well-earned afterlife.