The stakes are high and the mechanics tricky when a series’ season ends. On the one hand, finales ideally should leave viewers feeling a sense of closure — satisfied that whatever loose ends were established during the course of the season were tied up at the end. On the other hand the finale often acts as a cliffhanger, leaving the viewer hungry for more and anticipating the season to come.

“That’s become a big part of TV watching,” says “Justified” creator-exec producer Graham Yost. “There’s often a big audience response to the season finale, and that creates a lot of pressure to do it right.”

When “Smash” ended its maiden 15-episode run in May, it was established who would play the lead in the series’ fictional Marilyn Monroe musical while leaving open the possibility for further complications down the road.

But the “Mad Men” finale in June, true to the series’ character-driven, increasingly existential nature, was more oblique, with Madison Avenue guru Don Draper (Jon Hamm), seemingly more disillusioned than ever and drifting back to the dark side after a game attempt to clean up his act.

To Andrew Marlowe, creator and exec producer of “Castle,” “the most satisfying season finales resolve something in the audience’s emotional experience, but also create some new aspect of the storytelling to look forward to.”

It’s an ideal balance whose path begins at the earliest writers’ meetings.

Says Yost, “You ask yourself, ‘What are the moves I need to make now?’ And the reality is, most shows use the year (to work out the details). You can have rough goals, but the actual getting there is just something you do when you get to it.”

According to creator and exec producer Theresa Rebeck, “Smash” was always planned as a variation on “A Star Is Born,” in which Marilyn hopeful Karen, played by Katharine McPhee, “is a star in the making, and the question is how do you get her there? How fast do you pace it out?”

She recalls, “I had to present an entire arc’d-out season last June, which I do think is necessary for serialized drama. You have to have the benchmark moments structured in, but leave enough room for surprises that come along … opportunities that can change your course.”

One course-changer occurred in episode 10, when director Derek (Jack Davenport) began experiencing fantasy visions of Karen in full Marilyn regalia. The “visual experience of his growing fixation,” as Rebeck describes it, both sets up Karen’s eventual triumph and brings her rival, Derek’s mistress Ivy (Megan Hilty), to a breaking point.

“When he tells Ivy ‘I see her,’ it pushes her to that devastating place with the pills. We were trying to turn the heat up on her, and that’s the moment that really does her in.”

Though Rebeck won’t return for season two, “Smash” addicts are eagerly waiting to learn where those pills, and Ivy, end up.

A “Justified” season, Yost reports, is planned around a unique central narrative whose clear-cut resolution emerges over time. An actress pointed the way to the denouement of last year’s clan blood feud, which ended season two.

“When we saw how brilliant Margo Martindale was, poisoning this guy in episode one, we knew that’s how we’d have to end: with Margo poisoning herself.” Martindale nabbed an Emmy for the mournful yet elegant bookending.

A season later, the combination of a sophisticated urban hitman with a hidden gun up his sleeve and an abattoir glimmering with cleavers inspired a final chop-shop sequence giving new meaning to the director yelling “Cut!”

“I liken a TV season to driving through fog,” says “Castle’s” Marlowe. “Things present themselves with a lot more clarity as they get closer to you.” That’s actually a must, because “if you try to be too precise about where you’ll be at season’s end, it becomes more of a mechanical exercise rather than what it should be, an emotional exercise.”

His show’s weekly crime solving is complemented by two ongoing emotional story arcs: the grand conspiracy behind the killing of the mom of homicide detective Kate Beckett (Stana Katic); and her will-they-won’t-they flirtation with the titular novelist, played by Nathan Fillion.

Both storylines were integral to the wrap of season three, in which Castle can’t tell whether a critically wounded Beckett heard him avow his love, and she’s unaware of what he now knows about the conspiracy.

Marlow says “Castle’s” fourth season became a season of secrets, which wound up bringing the pair together once and for all. “The moves we had to make to keep them apart felt more and more artificial. This becomes a natural launch into next season. Now what? What happens when they wake up the next morning?”

Scribes agree on the need to keep faith with the viewer. Audiences pay close attention, says Rebeck, so “you have to respect what’s already (been) shot.”

Marlowe speaks of the promise a storyteller makes to resolve built-up tensions organically.

“You satisfy the audience and frustrate them at the same time, and that’s when you’ve done your job as a dramatist,” he says. “The best version is ‘Who Shot J.R.?,’ and the worst is someone wakes up, it’s all been a dream and you’ve betrayed your covenant with the audience.”

When everything comes together, a finale can be unforgettable and the next phase irresistible. To Rebeck, the dissidents’ walkout in “Mad Men’s” season 3 was “cunning, surprising, thrillingly logical and daring, and it totally re-set the show for me.”

Yost recalls when Jim Sikking’s “hard-ass militaristic SWAT-type character” put a gun to his mouth to end a “Hill Street Blues” season with a blackout and gunshot.

“You kinda knew, by cutting to black, that he probably didn’t kill himself. (He didn’t.) But I know I tuned in for the premiere of the next season.”

Personification of bravo brand