The idea for the episode came from a combo of a few things: a sitcom script written by creator Charlie Brooker about a band that died and came back to life to discover how popular they had become, the trend of artists continuing to tour as holograms after their deaths, and people having Alexas in their homes and "how they provide companionship of a kind," Brooker told EW.
Annabel Jones told EW that Cyrus embodied the attitude of the story they were trying to tell, "about an artist and how they're trying to find their own identity and break out from the commercial machine," with a story that becomes more heightened and sarcastic and satirical as it goes on.
Because they knew viewers would need to connect with Ashley O as a pop star immediately, an actual pop star made the most sense to cast. According to Variety, while Brooker and Jones had no connection to her at all, Cyrus had seen the show before (in fact, she told The Guardian she's a "huge" fan), and committed quickly after reading the script.
With so much experience with the real life of a pop star, Miley added some of her own observations to the story. Jones told EW she specifically had thoughts on the costume and look, and Brooker explained that one of her influenced the presentation the aunt gives before revealing the hologram.
"During our initial conversation, she described recently supporting another act—an act for an older generation where she did a cameo. And Miley stepped on stage and saw their faces because they weren't all filming her on their phone, and she really enjoyed it and hadn't realized how much she missed taht. There were lines about that that ended up in [the episode]."
The song that Ashley O sings is a reworked version of Nine Inch Nails' "Head in a Hole," from 1989, with a few new lyrics more suitable to a bubblegum pop star. The song in the end credits is an actual cover of the song, performed by Cyrus.
"There's nothing worse than when you're watching a film or a TV show about someone who is meant to be a celebrity, be they a comedian or a musician or whatever, and you just don't believe that they would actually be very successful," Brooker told GQ of the worry over having to write a believably popular pop song. "I was just out for a run with Spotify playing, and some Nine Inch Nails came up. And I thought, You know what? You could turn this into bubblegum pop. You could turn this into dance pop if you tweaked it a bit."
Nine Inch Nails frontman Trent Reznor turned out to be a big Black Mirror fan and loved the idea, so he fully approved.
Even in the midst of promoting her new EP, Cyrus went full Black Mirror on social media, changing her name and profile pics to the fictional popstar and posting multiple Instagram pics in Ashley O's signature purple wig.
"I love you Miley but I listen to Ashley O," she captioned one, referencing some of her new lyrics.
"There is a part of Ashley O that is not a character," Cyrus told The Guardian, going on to say that the pop world it portrayed was "eerily" familiar to her. "You can see it playing out in the media right now. There's huge similarities with what we see in pop music today."
"I think it's an important story that needs to be told, such a realistic take on what it's like working in the music industry. It really portrays the overt exploitation of artists and that numbers usually eclipse the creative most of the time," she said.
Cyrus was filming the show in South Africa in November 2018, at the same time that back in Malibu, devastating fires were burning her house down.
"I want to say that I was so impressed and proud of Miley because when we were filming her scenes—I think, to be more specific, when her character wakes up from the coma—her house was burning down in Malibu," costar Madison Davenport told Vulture. "She had to work through that. I'm so proud to say we were there with her during that, and she did it. She f--king did it."