"About 98 percent," says David Brady.

"What happened?" he says nervously.

Felix, sensing panic, jumps in. "About 500 people just walked in," he says. "They're coming in waves."

"Wow, people really went all out," he observes. "Americans are really good at partying," he says, turning away. "Swedish people would be too cool for this kind of thing. We're, um...what do you call it? Emily, do you know which word I use?"

"Douchey?" Emily says.

There are 24,000 people there by the time he goes on, and afterward, he is sweaty and giddy. "They were really into that new one, the one that goes, brn-nrew-nrew nrew nrew nrew nam," he says as the van takes off for LAX, accompanied by a police escort David Brady hired to run all the red lights.

"Faster! Faster!" Tim urges playfully as the van screeches around a curve and everyone laughs. But the mood grinds to a halt at LAX along with the car, which is detained by security. "What the fuck?" he says, peering out at the airport officials sweeping under the car with their flashlights. "Why is this happening?" he demands of Felix. "Didn't you call ahead?"

Ten minutes later, we're on the plane, but Tim stays quiet for the rest of the trip, moving the cardiograms of song around on his laptop.

By 2 a.m., XS has given itself over to full New Year's Eve abandon. Kathy Hilton, Paris's mom, is dancing on a platform next to the stage, and girls with small dresses and hungry eyes are jammed into the velvet-roped area behind the DJ booth. Felix, who's been doing his usual business of lighting cigarillos and pouring drinks, has been attempting to keep them away from Tim, but at some point a skinny brunette attached herself to Felix and is hanging from his neck like a scarf. Nearby, Emily is swigging champagne and watching the scene. "Is this totally insane to you?" she types on her phone, showing me the screen. "I see it all the time and I still think it's completely excessive and disgusting."

With the brunette in his blind spot, Felix doesn't notice an XS promoter sneaking up, a bottle of Dom Pérignon in his hand. Seconds later he is batting foam out of his eyes, rivulets of $900 champagne streaming down his bald head, calling for reinforcements. A train of bottle-bearing waitresses marches in like the cavalry.

One hand on his headphones, the other on the fader, Tim is too focused on keeping the crowd jumping in front of him to notice the douchiness going on behind him. He is in what Felix calls "his zone," where tension and fear and anxiety are obliterated by the pounding of the bass and the swell of the melody, and all that remains is the need to keep it going, to keep the energy up. He lifts a hand in the air, unselfconsciously mouthing the lyrics to his biggest hit: Ooooh sometimes I get a good feeling.

He's only contracted to play for two hours, but 3 a.m. comes and then 4 a.m., and Tim is still going. He burns through everything in his repertoire, some generic crowd-pleasers, the tracks he's testing out from the album he's working on, which will feature real instruments and "a lot of talented people," he'd said earlier. "Like people with real talent." He is so successful at making the audience feel like they can't leave that many of them stay well past the time they should. By four thirty, the girls shimmying on tables have come to resemble Depression-era marathon dancers, all bloody blisters and smeared eye makeup. One of the security guards is taking out a girl doubled over in a wheelchair, puke-stained hair grazing her knees.

Through it all, Tim just keeps shaking his hips and pounding his hand in the air. He doesn't even see that right behind him, someone has taped Emily's legs together with electrical tape, leaving her flapping on the platform like a drunk mermaid, a bottle of Dom Pérignon clutched in her hand, or that when she starts to cry, it is Felix who bends down and untapes her. It is 5 a.m., and the air is heavy with exhaustion and sudden sobriety, but Avicii puts on another track, and everyone rallies, as he knows they will. He just isn't ready for it to end.

Jessica Pressler is a contributing editor for New York magazine.