Actress Eliza Coupe was so certain her sitcom "Happy Endings" wasn't going to be renewed that she went into her bathroom last April and chopped off much of her long, blond locks.

"I had a 'Black Swan' moment," she said.

Good thing Coupe's hair grows back fast. "Endings" returns to ABC Tuesday, despite ending its second season 83rd in the Nielsen ratings, a disappointing number considering its lead-in show was the monster hit "Modern Family." Its new lead-in: ratings blockbuster "Dancing With the Stars."

ABC Entertainment President Paul Lee said he rolled the dice on the struggling series about six tight friends in Chicago because it's "super-smart" television.

He's right -- but like many of TV's best comedies, it didn't start out that way.

"Everybody Loves Raymond," "Seinfeld" and "Friends" all took time to find their rhythm. "Friends" had the same daunting challenge as "Endings": kicking off the series with a major character leaving her boyfriend at the altar. Not exactly a gold mine for comedy.

"I like the stories we got out of that premise, but some people thought the situation didn't seem that funny," said creator David Caspe. "We had to pull ourselves out from under. I'll be honest. It was a challenge."

An even bigger challenge was persuading ABC to keep the show on the air. In the days when broadcast networks dominated television, they were more willing to let shows dwell in the ratings basement for a while. "Cheers" spent its first couple of seasons as one of TV's least-watched shows -- then became a juggernaut.

"Happy Endings" co-star Damon Wayans Jr. was so convinced the network would bail on the show that he shot the pilot for "New Girl." (He was replaced by Lamorne Morris.)

But "Endings" benefitted from low expectations.

"We luckily never had a lot of pressure to get big ratings or get a certain demographic," said cast member Adam Pally. "We're being allowed to do the show for ourselves and hope people latch on."

Secret 1: Find your inner crazy

"Endings" found its stride in its second season (out on DVD this week) by letting the characters get more outrageous. Penny (Casey Wilson) declared it to be "The Year of Penny," only to discover her new apartment was cursed. Alex, the runaway bride (Elisha Cuthbert), adopted a racist parrot. Her former fiancé, Dave (Zachary Knighton), turned his food truck into a speakeasy. Max (Pally) considered reuniting with his all-male Madonna cover band.

Wayans, who plays a go-getter way too comfortable with his feminine side, said it took the writers a while to figure out where these characters fit in their fictional world.

"In the second season, they allowed me to play around more and be a little sillier," said Wayans. "If you're doing a comedy, you don't need a straight character. You might need one in a certain scene, but we take turns."

All six actors have an aptitude for physical comedy.

In early episodes of season three, Max and Dave nearly destroy their apartment trying to break open a piñata stuffed with Nerds candy. Hapless Penny tumbles down the stairs and winds up in a body cast and the entire gang dresses up as a marionette version of the Jackson Five.

Cuthbert, best known for playing Jack Bauer's daughter on "24," admitted it was intimidating being surrounded by seasoned comedians, but she finally felt like one of the team when Caspe encouraged her to perform an invisible hula-hoop routine she had showed off at a cast party.

"That was the catalyst," she said. "It allowed me to do whatever I wanted the rest of the season and not feel weird about it."

Secret 2: Offer hidden gems

When the cast isn't engaged in pratfalls and spit takes, they're delivering some of the most obscure zingers on network television. In upcoming episodes the references include the Miami Heat's Chris Bosch, a David Bowie-Mick Jagger liaison, "Hot in Cleveland," Sinbad, Keyser Söze, "Ebony & Ivory," Mos Def, Scott Caan, "The Hunger Games" and Wendy Williams.

Coupe was amazed that producers didn't cut an improvised scene during a fight with pigeons in which she referenced the song "Feed the Birds (Tuppence a Bag)" from "Mary Poppins."

"Maybe it went over most people's heads, but on Twitter people were like, 'I can't believe you said that,'" she said. "I think we have enough broad jokes and if some get the obscure ones, it's like a little gem."

Secret 3: Have patience

It won't get any easier attracting a wider audience. Yes, the show is moving to a cushy spot on Tuesday nights, but it's also up against Fox's "New Girl" and NBC's "Go On," the new Matthew Perry sitcom that already has been picked up for a full season.

Being the underdog may serve the show well in the long run, Cuthbert said.

"If our success is going to be slow and steady, I'll take that over the pressure of too much hype and not living up to it," she said. "Are we the biggest thing that ever happened? No, but we're still on the air and we have the potential to get there."

njustin@startribune.com • 612-673-7431 • Twitter: @nealjustin