Julianna Margulies as lawyer Alicia Florrick in CBS’s “The Good Wife,” which will air its final episode Sunday. (Jeffrey Neira/CBS)

“The Good Wife,” CBS’s critically acclaimed and popular television series focusing on the personal and professional lives of Alicia Florrick, played by Julianna Margulies, ends Sunday. The show’s “good wife” stands beside her politician-husband after he has been caught in a sex scandal. Through the show, we learn what she’d been thinking – and, presumably, what many real women had been thinking at similar horrible and embarrassing points in their public and personal lives.

And over its seven years, the show has quietly shifted network programming and content in significant ways.

An intimate look at the “political wife” — and her education

Alicia Florrick was a stand-in, when the show first aired in 2009, for Silda Spitzer, Jenny Sanford, Hillary Clinton, and maybe even Dina McGreevey and Suzanne Craig. Florrick represented the bright, educated woman who helped her husband, Peter Florrick, climb the political ladder, taking care of their family so that he didn’t have to, at her own career’s expense — the woman whose story is so rarely told, who is so often portrayed as a two-dimensional afterthought in the tragedy of the transgressive hero.

Faced with the collapse of the public image of perfection that she had helped create, we saw the transformation of “St. Alicia” the self-sacrificing helpmate into a much fuller and more complex person, forced to compromise in balancing her needs with others’ and to take moral responsibility for her choices.

Like any good hero quest, “The Good Wife” showed us characters in extraordinary situations that were familiar at the same time. Alicia remade herself from domestic wife to a sharp-elbowed lawyer. She became a single parent and sole breadwinner when her husband was convicted and imprisoned. Because she needed to support her family, Alicia pursued a “first-year associate” opening at Stern, Lockhart & Gardner many years after she completed law school, competing with others half her age.

The show traces her complicated but “normal” array of responsibilities: taking care of adolescent children and extended family, maintaining a marriage (such as it was) and friendships, and meeting the demands of a high-powered legal position.

Which is not to say that Florrick was “everywoman.” The show explored the different kinds of privilege carried by her position, education and political connections. Every time Alicia entered a courtroom, everyone knew exactly who she was and to whom she was married. Since her husband is simultaneously politically powerful and damaged throughout the series, this reputation provides Alicia with access, but is often tainted.

Alicia builds her own political and legal reputation — running for state’s attorney in the sixth season — while trying to separate her political and professional life from her husband’s. This parallels Hillary Clinton’s path, moving out of her role as first lady to become a U.S. senator representing New York and then secretary of state after running for the Democratic presidential nomination, and then doing that last bit once again. Alicia, like Hillary, had to disconnect herself from her husband and create her own reputation — though in both cases, the wives continuously find themselves pressed into defending their husbands’ political and personal decisions, as well as their own.

Putting a woman at the center of a political story

Having Alicia’s story be central distinguished it from many recent male-centered prestige dramas and opened the door to hits such as “Scandal,” “How to Get Away With Murder,” “Madam Secretary,” “UnReal,” “Jessica Jones,” “Orphan Black” and others. “The Good Wife” was not the first network series to focus on a female protagonist. But by focusing consistently on Alicia’s character and her dual evolutions, the series contributed to a shift in narrative perspective, without relying on superpowers, historical dimensions, excessive melodrama or sui generis settings. The series neither plays down Alicia’s sexuality nor lets it take over the narrative arc. Alicia transforms herself as we watch her make decisions, good and bad, that she takes ownership of, living a life no longer based on the expectations of others.

Of course, the journey from disillusionment to renewal is a common tale. American culture has been full of characters forced to re-invent themselves and remake their lives. But these characters are so often male. And so it’s been exciting and novel to see a woman cast in this hero role. Unlike many of her male counterparts, she doesn’t become an antihero — but she does get a bit of an education.

Alicia engaged in various forms of politics in the context of her legal cases. In defending the fictional internet behemoth ChumHum, a stand-in for Google, Alicia and her colleagues often found themselves arguing fascinating questions at the very edge of existing law, while also tangling with complicated issues of race and gender that filtered through unexpected venues, such as search engines.

St. Alicia also found herself representing clients she knew to be criminals, murderers and drug dealers, with Mark Zuckerberg-like and Edward Snowden-esque clients thrown in for good measure. She faced off against lawyers whose disabilities she learned to accommodate, and she often found herself negotiating an understanding of the role of her gender in the courtroom. While aspects of these cases may have been “ripped from the headlines,” the arguments often highlighted absurdities in the execution of laws, or the constraining nature of legal solutions to complicated and often messy technological, political and emotional problems.

We also saw small-p politics, as Alicia navigated the power dynamics among partners at “white shoe” law firms. A constant tension on the series was Peter’s need for Alicia to continue standing beside him to further his political career. She learned to negotiate the terms of this deal – from her own apartment, to unquestioned romantic relationships, to his help with her own political career. This culminated in the full-circle visual moment of the series, where Peter stands next to Alicia as she steps down from the state’s attorney job she has won. Marital and gender roles have flipped: Alicia is now the one in the spotlight. But it’s a bittersweet moment, not one of triumph. She has both won and lost the position because of dubious, yet politically necessary, maneuvers by both herself and her husband.

An audience for a strong and complicated female hero

“The Good Wife” has had a sizable audience, with consistently high ratings for a network series over seven seasons. The series premiered with nearly 14 million viewers and sustained a typical audience of 10 million. Compared with prestige dramas such as “Mad Men” (with an average of about 2.5 million viewers) or “The Sopranos” (which had spikes that matched “The Good Wife” but was not as consistent), “The Good Wife” has demonstrated the broad cultural reach of and hunger for stories about smart, attractive women navigating life’s complexities according to their own ambitions and values. 

“The Good Wife” included all the usual guilty pleasures of aspirational television. We saw beautiful people in fashionable clothing. Michelle Obama wore the same Michael Kors suit as Alicia Florrick, after Alicia had worn it, to the 2015 State of the Union address. There were Twitter threads envying the over-the-knee black leather boots of investigator Kalinda Sharma (Archie Punjabi) and weekly online discussions of  the “breastplate-like” power necklaces of law partner Diane Lockhart (Christine Baranski). We saw them working in sumptuous offices, driving high-end cars to luxurious homes.

But the pleasures weren’t simply guilty. That luxury became part of the story line, as the show explored what Alicia and others had to give up, morally, professionally, legally, to achieve these aspirations.

And that’s how “St. Alicia” ceased to be so. While she started out innocently “good” according to traditional morality and femininity, the show forced her to achieve her position not by deferring to a husband but by confronting those legal, political and romantic compromises for herself, letting the audience think through her dilemmas by proxy: Would we have chosen the same or differently?

Having a woman as the main character has been central, not incidental. It has allowed “The Good Wife” to explore and expose the presumptive moral purity of the self-sacrificing wife — a particularly female trope — by forcing her to grow up, choose her path for herself and create her own independent life, where she is consciously happy. Was her goodness real — or was it naivete?

Dramatic narrative often provides audiences with heroes and villains. “The Good Wife” instead gave us characters as mixed as most of us are, with ego, selfishness and greed entwined with our better natures. This show offered differing perspectives on financial, sexual, professional and spiritual satisfaction. Instead of asking the trite question “Can she have it all?” this show takes a privileged, talented woman and explores what she really wants, how that is shaped by societal expectations, the limits of what is possible for powerful women, and the moral or emotional compromises that power will require.

The series is concluding with Alicia, aligned with Diane Lockhart, as the named partners of Chicago’s first female-only-led law firm. She successfully ran for office and then chose to resign the seat. And she has finally decided to divorce Peter, even as he is both running for president and on trial. Alicia has expanded her own conception of “the good life” and grasped hold of her desires for herself.

In the process, she has confronted sexism in the workplace, the loss of people she loves, her need to accept her children’s independence and her own professional failures. The show has revealed the particular limitations on women, both from the outside and from within their own expectations, confidence and desires. That’s why I — and, I suspect, many other fans — have kept returning every Sunday night.

Lilly J. Goren is professor of political science and director of the honors program at Carroll University in Waukesha, Wis., and co-editor of Women and the White House: Gender, Popular Culture, and Presidential Politics.