Even in a completely empty theatre, Max Martin manages to disappear, choosing to perch himself on the back row, almost completely hidden in shadow. If you didn’t know whom you were looking for, you would assume the long-haired, 48-year-old Swede, dressed in a black T-shirt, was taking a break from shifting props for that night’s performance of the new jukebox musical & Juliet.

It seems inconceivable that someone so unassuming could have dominated pop music for more than 20 years, but the statistics speak for themselves. Martin has co-written and co-produced 73 US Top 10 singles for the likes of Taylor Swift, Ariana Grande, Katy Perry and Britney Spears. Twenty-two went to No 1, with 12 also topping the UK charts. Collectively, these have sold more than 150m copies globally, earning Martin an Oscar nomination, five Grammys and the 2016 Polar Music prize (previously won by Bob Dylan and Patti Smith). Martin’s 22 US No 1s make him the third-most successful songwriter in US chart history, behind only Paul McCartney (32) and John Lennon (26).

He is the man who introduced the imperishable, if occasionally linguistically questionable, choruses “Hit me baby one more time”, “I kissed a girl and I liked it” and “Backstreet’s back, all right!” to karaoke booths everywhere, with songs that were at once dramatic, melancholic and never less than relentlessly catchy. The hugely ambitious & Juliet – a modern re-telling of Shakespeare’s Romeo & Juliet in which Juliet decides not to kill herself , but to head to Paris in order to live a little – is woven expertly around 30 of these hits, originally written for artists ranging from Celine Dion to ‘NSync, the Weeknd to Pink.

Martin hardly ever gives interviews. “I’m not a shy person,” he clarifies as we sit in one of Manchester Opera House’s tiny bars, his accent a mix of Swedish and the Los Angeles drawl of his adopted home. “I just like to stay in the background as much as possible.”

When I heard Britney singing I just knew instantly. The way she recorded that song, she added another dimension Max Martin

Ever since he earned his first US Top 10 hit in 1997 by co-writing and co-producing fellow Swede Robyn’s Do You Know (What It Takes), Martin has been a self-confessed “studio nerd tucked away in a basement somewhere”. One rock star due to get the Max treatment assumed the quiet man he had met was an engineer and asked him when Martin was due to arrive.

We are joined by the writer of & Juliet’s book, David West Read, who, much to Martin’s delight, has shown up in a vintage Britney T-shirt. “You’re about to find out I love talking,” Martin continues, popping a snus (a moist tobacco bag, popular in Sweden) under his top lip. “We’ve been putting a lot of work into & Juliet and it’s a new field for me, so I don’t mind talking about this.”

Martin had been toying with the idea of a jukebox musical for years, inspired by Abba’s global behemoth, Mamma Mia! If a feminist retelling of a Shakespeare soundtracked by Spears sounds like the work of someone who has just had a bump to the head, well, that is because it is. “I had hit my head on a kitchen cabinet and couldn’t look at screens or light for a while,” West Read says (he was concussed). “So I made a playlist of Max’s catalogue and realised that so many of the songs are about young love … of course Romeo & Juliet came to mind.”

Bard times … the cast of Max Martin’s new musical & Juliet. Photograph: Michael Wharley

As well as getting involved in the auditions and workshops, Martin also recorded the cast album. “I couldn’t be like: ‘Oh, just do it,’” he says. “A lot of the songs were written with the artists and co-writers, and so I feel responsible for all these people that have been involved throughout my career.” It also represented something that has perhaps been missing from his, as he calls it, “day job”: risk. If you have done it all, your songs turning Swift, Perry and Grande into superstars, where do you go next? “There was so much for me to learn here,” he smiles. “It’s easy to go on autopilot. If I’m feeling uncomfortable then that’s probably where I should be, rather than in a place where I’m like: ‘I totally got this.’”

The foundations for Martin’s empire were laid during an apprenticeship with Denniz PoP, whose 90s productions for Ace of Base had become international hits. Martin (born Karl Martin Sandberg in Stockholm) had played the French horn at school; when he met PoP (born Dag Krister Volle) he was the frontman of It’s Alive, a Kiss-inspired glam rock band. Discerning that Sandberg had an ear for pop music, PoP – a fan of pseudonyms – rechristened him Max Martin and employed him as a songwriter and producer at his Stockholm powerhouse, Cheiron studios. Cheiron’s records would fuse R&B grooves with happy/sad Abba-esque melodies. The former glam rocker Martin brought an edge of bombast and some weapons-grade melodies, soon employed on records for the Backstreet Boys and the British boyband Five.

PoP died of cancer in August 1998, two months before the release of what may be Martin’s most famous creation. ... Baby One More Time, which he wrote singlehandedly, got to No 1 in just about every country it was released. But it almost came to nothing. The demo, Martin remembers, sat lying around for “maybe six months, a year” and attempts were made to pitch it to “really established artists”. Eventually the Backstreet Boys’ label, Jive, offered it to their new signing, Spears. “When I heard her singing, I just knew instantly,” he says. “The way she recorded that song, she added another dimension.”

Among the artists who turned it down were TLC, assuming that the line “Hit me baby one more time” advocated domestic violence. Martin and his fellow Swedes at Cheiron had meant it simply as slang for “call me”. Other Martin lyrics of the era also presented problems for West Read when he was weaving them into & Juliet. “It’s really kind of confusing,” he says of the Backstreet Boys’ I Want it That Way, a song that seems to undermine itself at every turn.

“You know that’s a thing, right?” Martin beams proudly. “Like: ‘What does it mean?’ There were forums of people discussing it.”

One more time … Max Martin and Britney Spears in 2017. Photograph: Lester Cohen/WireImage

While the grammatical error that appears in Ariana Grande’s 2014 EDM stomper Break Free (“Now that I’ve become who I really are”) may have been placed there on purpose – including a “juicy line” that sticks in the listener’s memory is a very Max Martin move – the Backstreet Boys song is a clearer example of Martin’s obsession with words serving the melody, a concept he calls “melodic math”.

“Growing up, I listened to songs by Abba, Elton John, the Beatles, and I had no idea what they meant, so to me phonetics have always been important,” he explains. “I felt something hearing this music, and it meant something to me. If you can have a great lyric that also phonetically sounds amazing, then you’re golden. But it’s also kind of cool if you write a song and people are emotionally moved without understanding what’s being said. That, to me, is as powerful.”

He favours simplicity, repetition and instant familiarity over unnecessary complexity, but balks at the idea that his songwriting is governed by strict rules. “It’s about having tools for when you’re stuck,” he says, leaning in as if divulging a secret. “If you have a verse that’s super-busy, and you want to take it to the next part, you might want something that has a little more space, so [the listener] can take in the information and not get lost.”

You can hear this technique on Taylor Swift’s Shake It Off, for example. “That’s a mathematical way of thinking, it’s not about doing it by feel,” he concedes. “But if it’s flowing, you don’t need any of that stuff.” He thinks for a moment. “Also, if there was a hard rule then all of my songs would be huge and, trust me, they’re not.”

I’ve seen it many many times, what fame does. We’re not made to be that famous, it’s not normal Max Martin

Martin’s early hit rate largely depended on Spears. A handful of their collaborations forms the backbone of & Juliet, tracing a narrative arc that runs from ... Baby One More Time’s “my loneliness is killing me” to Stronger’s assertive declaration of the opposite (“My loneliness ain’t killing me no more”). Did you allow yourself a little high five in the studio when you linked those two songs? “Er … maybe,” he laughs, self-effacing as ever.

He is keen, too, to give the artists he has worked with credit, even when, as he puts it delicately, “someone isn’t a songwriter per se”. Britney Spears, for instance. “She’s a genius,” he says, popping a fresh snus. “So much had happened to her in that [early period] and she had to grow up quickly. We had conversations with her about what she wanted to do and what she wanted to say.”

Nonetheless, the world of pop songwriting and production is still dominated by men, easily characterised as ruthless svengalis. “I don’t want to think I’m one of them,” Martin says carefully. “We try and do our best to make [the studio environment] diverse, welcoming and inclusive. Let’s try and inform and be role models as much as possible in our world and hopefully it will spread.”

Would he like to see more female producers? “Women aren’t encouraged in the right way,” he says. “We’re still programmed to think: ‘The boys take care of the computers’ and that has to change, and it is changing. Even if you come from a very dark place of,” – he slips into a convincing American accent – “‘I want to make a lot of money.’ It’s a stupid decision. We’re missing out on 50% of the talent.”

A lot of Martin’s biggest hits have been with female artists: not just Spears, Swift and Perry but also British stars such as Adele, Ellie Goulding and Jessie J. He has seen at close proximity what can happen when unimaginable fame takes hold, not least Spears’s distressing, and hugely publicised, breakdown in 2007. “I think we all should be grateful [to the artists],” he says, growing animated for the first time. “It’s easy for us to say that they become these rich, spoilt divas – and I’m not talking about Britney specifically, just in general – but we forget that these artists go out into the world and work and tour and become super-famous for our enjoyment. And then we watch their lives fall apart in front of our eyes for doing something amazing.”

He sighs. “I’m so thankful that someone actually still wants that job. I’ve seen it many many times, what fame does. And it goes back to why I don’t do interviews. Especially now with social media: our lives are on display all the time and when you’re famous it’s on a whole other level. We’re not made to be that famous, it’s not normal. It’s not in our DNA.”

His more recent work with the likes of Normani and Grande have seen him embrace the fact that pop’s pendulum has swung away from pop and towards R&B and hip-hop, a shift that – when it happened in the early 00s with the rise of Pharrell Williams’s songwriting and production outfit the Neptunes – briefly knocked Martin off course. Does he have similar concerns this time?

“I’ve come to a point where I try not to think about the perception of the work,” he says. “The first time it happened, when the boyband era crashed in front of my eyes, I was freaking out a bit, but I’ve never really been worried.” That LA breeziness returns. “I’m not [making music] because I want to be successful; I would be doing this anyway. Also, popular culture is supposed to move.” Making records, he says, is “about staying inspired, but also sticking to your guns of what you love doing”.

Suddenly, the musical’s in-house band starts up next door, a sign that Martin is free to stop doing something he is still learning to love. As we get up to leave, we are joined by a PR who needs to speak to Martin about that evening’s opening press night. One-sided discussions are had about red carpets, photographers and local press, with Martin looking increasingly nervous. “I can still arrive via the side door right?” he says, edging back into the shadows.

& Juliet transfers to the Shaftesbury Theatre, London on 2 November. The cast recording is released on 15 November.

Max power

Martin’s landmark hits, by Ben Beaumont-Thomas

1996: Backstreet Boys – Quit Playing Games (With My Heart)

His production would get more sophisticated – the claps sound like the punching sounds from Street Fighter 2 – but the songwriting is already rock solid on his first US Top 10 single.

1998: ‘NSync – I Want You Back

With this and Tearin’ Up My Heart, Martin cemented his style of keeningly melancholic minor-key pop; despite their crotch-grabbing tempos, they are among the most savagely sad breakup songs ever.

1998: Britney Spears – ... Baby One More Time

The shamelessly provocative video helped her break through, but the song is what matters: one second and three piano notes was all it took to become unforgettable.

2004: Kelly Clarkson – Since U Been Gone

Martin’s ultra-synthetic pop was innovated out of the zeitgeist by R&B, so he wisely took a different tack. Strident, compressed guitars now underpinned his biggest hits, including another breakup masterpiece with Kelly Clarkson, as well as a string of songs with Pink.

2008: Katy Perry – I Kissed a Girl

By riffing on a bit of classic pop – Gary Glitter’s Rock’n’Roll Part 2, currently causing controversy in Joker – and adding Perry’s lipstick lesbianism, Martin created one of his most muscular, brilliant hits.

2012: Taylor Swift – We Are Never Ever Getting Back Together

Martin runs the acoustic guitars forwards then reverses them, the perfect sonic symbol for Swift stepping back from country and facing forward into pure pop.

2014: Ariana Grande feat Iggy Azalea– Problem

In Grande, Martin found a Britney-level foil: someone adept at both his traditional melancholia as well as exuberant sass. A string of brilliantly varied hits ensued.

2016: Justin Timberlake – Can’t Stop the Feeling!

With this good angel to the coke-snorting devil that is the Weeknd’s Can’t Feel My Face, another Martin smash the same year, the producer brought an ass-shaking disco sensibility to the middle of the decade.

2019: Sam Smith – How Do You Sleep?

With Grande, Martin has helped to define pop’s current dominant mode, where intimacy and sensuality is prized over trashy bombast, and yet still works in the club. This cut with Sam Smith is a beautiful example.