Ester Dean, center, has written smash hooks for Rihanna and Nicki Minaj. Illustration by Michael Gillette

On a mild Monday afternoon in mid-January, Ester Dean, a songwriter and vocalist, arrived at Roc the Mic Studios, on West Twenty-seventh Street in Manhattan, for the first of five days of songwriting sessions. Her engineer, Aubry Delaine, whom she calls Big Juice, accompanied her. Dean picked up an iced coffee at a Starbucks on Seventh Avenue, took the elevator up to Roc the Mic, and passed through a lounge that had a pool table covered in taupe-colored felt. Two sets of soundproofed doors led to the control room, a windowless cockpit that might have been the flight deck of a spaceship.

Tor Hermansen and Mikkel Eriksen, the team of Norwegian writer-producers professionally known as Stargate, were waiting there for Dean. Both are tall and skinny ectomorphs with pale shaved heads who would not look out of place in a “Matrix” movie. Dean, who is black, is neither skinny nor tall; she reached up to give them big hugs, which is how she greets almost everyone. They chatted for a while. Dean has a comical, Betty Boop-ish speaking voice, which will be featured in the upcoming animated film “Ice Age: Continental Drift.” (Sid, the giant ground sloth voiced by John Leguizamo, is finally getting a girlfriend, Dean’s Sloth Siren.) After ten minutes or so, she pronounced herself “ready to work.”

Most of the songs played on Top Forty radio are collaborations between producers like Stargate and “top line” writers like Ester Dean. The producers compose the chord progressions, program the beats, and arrange the “synths,” or computer-made instrumental sounds; the top-liners come up with primary melodies, lyrics, and the all-important hooks, the ear-friendly musical phrases that lock you into the song. “It’s not enough to have one hook anymore,” Jay Brown, the president of Roc Nation, and Dean’s manager, told me recently. “You’ve got to have a hook in the intro, a hook in the pre-chorus, a hook in the chorus, and a hook in the bridge.” The reason, he explained, is that “people on average give a song seven seconds on the radio before they change the channel, and you got to hook them.”

The top-liner is usually a singer, too, and often provides the vocal for the demo, a working draft of the song. If the song is for a particular artist, the top-liner may sing the demo in that artist’s style. Sometimes producers send out tracks to more than one top-line writer, which can cause problems. In 2009, both Beyoncé and Kelly Clarkson had hits (Beyoncé’s “Halo,” which charted in April, and Clarkson’s “Already Gone,” which charted in August) that were created from the same track, by Ryan Tedder. Clarkson wrote her own top line, while Beyoncé shared a credit with Evan Bogart. Tedder had neglected to tell the artists that he was double-dipping, and when Clarkson heard “Halo” and realized what had happened she tried to stop “Already Gone” from being released as a single, because she feared the public would think she had copied Beyoncé’s hit. But nobody cared, or perhaps even noticed; “Already Gone” became just as big a hit.

A relatively small number of producers and top-liners create a disproportionately large share of contemporary hits, which may explain why so many of them sound similar. The producers are almost always male: Max Martin, Dr. Luke, David Guetta, Tricky Stewart, the Matrix, Timbaland, the Neptunes, Stargate. The top-liners are often, although not always, women: Makeba Riddick, Bonnie McKee, and Skylar Grey are among Dean’s peers. The producer runs the session and serves as creative director of the song, but the top-liner supplies the crucial spark that will determine whether the song is a smash. (When I asked Tricky Stewart to define “smash,” he said, “A hit is just a hit; a smash is a life changer.”) As Eric Beall, an A. & R. executive with Shapiro, Bernstein & Co., a music publisher, puts it, “The top-line writer is the one who has to face a blank page.” Stargate works with about twenty top-liners a year, and creates some eighty demos. These are sent out to A. & R. departments at record labels, to artists’ managers, and, finally, to the artists, for approval. Around twenty-five of Stargate’s songs end up on records each year.

Dean has a genius for infectious hooks. Somehow she is able to absorb the beat and the sound of a track, and to come out with its melodic essence. The words are more like vocalized beats than like lyrics, and they don’t communicate meaning so much as feeling and attitude—they nudge you closer to the ecstasy promised by the beat and the “rise,” or the “lift,” when the track builds to a climax. Among Dean’s best hooks are her three Rihanna smashes—“Rude Boy” (“Come on, rude boy, boy, can you get it up / Come on, rude boy, boy, is you big enough?”), “S&M” (“Na-na-na-na COME ON”), and “What’s My Name” (“Oh, na-na, what’s my name?”), all with backing tracks by Stargate—and her work on two Nicki Minaj smashes, “Super Bass” (“Boom, badoom, boom / boom, badoom, boom / bass / yeah, that’s that super bass”) and David Guetta’s “Turn Me On” (“Make me come alive, come on and turn me on”).

“Talk That Talk,” a Dean-Stargate song that’s the title track of Rihanna’s most recent album, is built around one chord progression—F-sharp minor, E minor, B minor, D. The music combines genres that, twenty years ago, were distinct: the hard beats of hip-hop and the big melody “money notes” sung by nineties stars such as Whitney Houston, Mariah Carey, and Celine Dion. The first hook comes right away, in an abbreviated chorus that precedes a Jay-Z rap. Then comes the main hook: “One and two and three and four / come and let me know if you want some more,” a salacious-sounding bit of rhythm singing, backed by dirty-sounding synths, which opens the chorus. Then there’s a verse, which delivers the third hook: “Say what you want, say what you like / Say what you want me to do and I got you.” The chorus rolls around again, this time with the lift, followed by the bridge, which delivers yet another hook: “What you say now, give it to me baby / I want it all night, give it to me baby,” sung over a nasty-sounding snare drum (which, like all the instrumental sounds, is machine-made). The bridge also conveys the “breakdown,” when the song’s momentum pauses momentarily. Then comes the chorus for a final time. The song is neither clever nor subtle—we are a long way from Cole Porter here—but it is deeply seductive all the same.

Dean’s preferred method of working is to delay listening to a producer’s track until she is in the studio, in front of the mike. “I go into the booth and I scream and I sing and I yell, and sometimes it’s words but most time it’s not,” she told me. “And I just see when I get this little chill, here”—she touched her upper arm, just below the shoulder—“and then I’m, like, ‘Yeah, that’s the hook.’ ” If she doesn’t feel that chill after five minutes, she moves on to the next track, and tries again.