NEW YORK

Jay Leno is facing the embarrassing public spectacle of leaving his dream job, not on his own terms. Sound familiar?

It’s a replay of the Conan O’Brien departure of three years ago, except this time, Leno is being ejected from “The Tonight Show” instead of taking back his old job.

Because of the turnabout, O’Brien, who has long since decamped for TBS, may find himself on late-night TV long after Leno is gone.

Adding to the indignity, Leno is being replaced despite leading his late-night rivals, David Letterman and Jimmy Kimmel, in total viewers and the key demos.

Leno’s going down, he’s going down fighting, using his monologues to mock NBC’s recent poor primetime ratings and joke that its executives are “snakes.”

This probably isn’t how Leno imagined he would end two decades as the head of one of show business’ longest-running institutions. But then, he had his chance at a graceful exit years ago and didn’t take it.

The New York Times’ Bill Carter is the uncontested authority on late night, so you can trust his report Wednesday that NBC wants to replace Leno with Jimmy Fallon by fall 2014. Carter’s books have chronicled both how Leno won “The Tonight Show” - and how he got it back from O’Brien.

If not for Leno’s handling of that situation, it might be easier for some viewers to feel sorry for him. 1/4

Leno’s transition was supposed to come in fall 2009, when NBC gave him a show that aired every night at 10. It was part of a plan five years in the making to hand “The Tonight Show” over to O’Brien while also keeping Leno at NBC.

But Leno’s show sagged in the ratings, and he was blunt when asked by Broadcasting & Cable, “Do you want to go back to 11:35?”

Replied Leno: “If it were offered to me, would I take it? If that’s what they wanted to do, sure.”

O’Brien’s announcer, Andy Richter, noted that that wasn’t the most respectful way to answer the question. But the ball was already rolling.

NBC took advantage of a clause in O’Brien’s contract that allowed it to move “Tonight” to 12:05 a.m., so Leno’s show could move to 11:35. But O’Brien, recognizing an indignity when he saw one, opted to leave, eventually landing at TBS.

As a result, O’Brien may have a late-night show long after Leno’s run on “Tonight” ends.

By taking back “The Tonight Show” in 2009, Leno may have limited his future late-night prospects.

A few years ago, he might have been able to jump to ABC, starting a new 11:35 show. But now that slot has gone to Jimmy Kimmel, who ABC hopes will lure more young viewers than Leno.

One reason NBC may want to accelerate Fallon’s move to 11:35 is so that he can compete with Kimmel for those same young viewers.

Leno is currently winning with those 18-to-49 year olds, but Kimmel is closing in. Since Kimmel moved to 11:35 in January, he averages 936,000 viewers in the age group to Leno’s 1.017.

Letterman attracts 873,000, and Fallon 669,000 - but Fallon airs an hour later, when fewer viewers are awake.

Could Leno move to Fox? The network already passed on trying to recruit O’Brien. And how would it look for Fox to launch a late-night slate with a 62-year-old castoff from another network?

Leno isn’t likely to go to cable, either. In the same B&C interview where he said he would take 11:35 back, he also volunteered, “I’m the mainstream guy. You could go out there and be the niche guy ... My thing is to balance mainstream and try to find that happy medium.”

Cable likely wouldn’t strike him as mainstream enough.