I first met Ariel Levy in 2009, soon after moving from London to New York, but I had been a fan for more than a decade. Her frank articles about pop culture and sex, which she wrote in her first job at New York magazine from the late 1990s, provided the template of what I wanted to write one day. Her 2005 book, Female Chauvinist Pigs, a blistering look at how young women were being sold the lie that emulating pole dancers and Paris Hilton was empowering, became one of the defining feminist statements of that decade. At the New Yorker, where she has been a staff writer since 2008, she breaks up the magazine’s occasional aridity with vivid articles about sexuality and gender. (She got her job when she told editor David Remnick that, “If aliens had only the New Yorker to go by, they would conclude that human beings didn’t care that much about sex, which they actually do.”)

Heroes rarely live up to your fantasies, but Levy exceeded them. Usually we’d go out for drinks – cocktails that knocked me sideways, but barely seemed to touch her sides – and from the start she struck me as being just like her writing: laid-back, wise, curious, kind. Sometimes Levy’s wife, Lucy, would join us. “Isn’t she hilarious?” Levy would say after Lucy had said something that wasn’t, actually, all that funny, but I envied them their mutual devotion after almost a decade together. I, by contrast, was lonely and, like generations of single women in their mid-30s before me, starting to panic. But like a lot of women of my particular generation, I felt ashamed of this. Panicking about not having a baby? How retrograde. So I never admitted any of it to Levy, who seemed more likely to eat her own hair than indulge in such uncool, unfeminist thoughts.

I left New York in 2012 and, despite my doomy fears, had twins when I was 37. Levy and I stayed in touch by email, and although her messages became shorter and more distant, I assumed everything was fine, because she was Ari. But in 2013, I opened the New Yorker and learned that it was not.

***

When we meet for brunch on a cold Saturday in February, it has been five years since we last saw each other. It’s a typical New York scene: weary and winter-pale parents eating scrambled eggs in a trendy restaurant while their sugar-rushed toddlers play on iPads. Levy, by contrast, looks calm, happy and healthy, and not just because she has a tan from a recent five-week stay in South Africa.

“If we had this conversation five months ago, I would have been in a bad way,” she says, in a lilting voice that often puts an unspoken “Oh my God!” and “Can you believe it?” behind her words. “But I’m so much less miserable – I’m not even miserable at all. So what the frack are we going to eat?”

We are just around the corner from Levy’s flat, where she has spent the past year writing a memoir. This in itself is something of a surprise, because she is not normally a first-person writer. But Levy, after negotiating her order with the waiter (“Ooh, the cheddar scramble – is that good? But do we have to have the creme fraiche with it? I mean, let’s not”), shrugs off any concerns about self-exposure: “I’m pretty open book-y, you know? I never understood what the big deal is about privacy. The hardest part was realising that I’d better mean what I say. The whole schtick of the book is acceptance and surrender. So after I finished writing it, I thought, ‘Wow, I guess I’d better follow my own advice now.’”

In 2012, Levy conceived a baby with sperm from a friend, having overcome the reservations she’d long had about parenthood. She was about to turn 38: “It felt like making it on to a plane the moment before the gate closes – you can’t help but thrill,” she wrote in her 2013 New Yorker article, Thanksgiving In Mongolia.

When she was five months pregnant, she flew to Ulaanbaatar for work. Her friends were concerned but, she wrote, “I liked the idea of being the kind of woman who’d go to the Gobi desert pregnant.” After two days of abdominal discomfort, she ran into the hotel bathroom, crouched on the floor and blacked out from the pain. When she came to, her baby was on the floor next to her. “I heard myself say out loud, ‘This can’t be good.’ But it looked good. My baby was as pretty as a seashell,” she wrote. She stared in awe at his mouth, “opening and closing, opening and closing, swallowing the new world”.

She had suffered a severe placental abruption, a rare complication in which the placenta detaches from the uterus. In shock, Levy held the 19-week foetus while blood spread across the tiles. She eventually called for help, taking a photograph of her son before the ambulance turned up. She was taken to a clinic where a kind South African doctor tended to her while she bled and sobbed. “And I knew, as surely as I now knew that I wanted a child, that this change in fortune was my fault. I had boarded a plane out of vanity and selfishness, and the dark Mongolian sky had punished me,” she wrote.

I don’t hear less privileged women thinking they’re entitled to everything, whenever they want it. The body doesn’t play by those rules

Levy flew back to New York and, within two weeks, her relationship with Lucy came to an end. For months afterwards, Levy continued to bleed and lactate: “It seemed to me grief was leaking out of me through every orifice.” She looked obsessively at the photograph of her baby, and tried to make others look, too, so they could see what she saw and they did not: that she was a mother who had lost her child.

Her article, which won a National Magazine Award in 2014, ends at that point, and I assumed that the end of Lucy and Levy’s marriage was tied to the loss of their child. In fact, that was “a whole other shitshow”, Levy says now. When she returned from Mongolia, she realised through her fog of grief that Lucy, who had struggled with alcoholism before, needed to go to rehab, badly. The women, still in love but too broken to support one another, separated. Today, they are in touch, but, Levy says, “There are times when one of us says, ‘I gotta stop talking to you for a while because this is too painful.’ Just because you get divorced, you don’t magically stop caring about each other.”

The breakup is one of only several shitshows recounted in Levy’s memoir, The Rules Do Not Apply, which looks, in self-lacerating detail, at events in her life before she went to Mongolia, and hints at some that came after. It is not the book that many expected would follow Female Chauvinist Pigs, not least because it could be spun as a warning to women about the perils of waiting too long to have a baby. Placental abruption, Levy writes, “usually befalls women who are heavy cocaine users or who have high blood pressure. But sometimes it just happens because you’re old.” She doesn’t go into this in the book, but Levy, who is now 42, has not been able to conceive again, despite having undergone “a ridiculous amount of IVF” over the past four years.

The alternative way of looking at Levy’s memoir is that she is dealing with a subject that feminism has never been able to resolve: the immovable rock of fertility, butting up against female progress. Levy says she had always wanted to be a writer, “so I built my life with that as my priority”; by the time she realised she also wanted to be a mother, she was in her late 30s. She writes that she and her generation “were given the lavish gift of agency by feminism”, coupled with a middle-class, western sense of entitlement that led them to believe that “anything seemed possible if you had ingenuity, money and tenacity. But the body doesn’t play by those rules.”

“Of course, this is partly about class,” she says now. “I don’t hear women who are less privileged thinking they’re entitled to everything, whenever they want it. That’s a privilege phenomenon, but it is a phenomenon. It makes me laugh when people say, ‘Why don’t you “just” do surrogacy, or “just” adopt?’ Believe me, there is no ‘just’ about them.” Surrogacy costs $100,000-$150,000 in the US, while adoption costs are on average between $20,000 and $45,000 (costs in the UK are much lower). After the money Levy spent on IVF (“A lot. A lot, a lot, a lot”), those options are less possible than ever.

Doomy warnings that women need to stop shillyshallying and sprog up are published in the Daily Mail every day. They are far less common from prominent feminist writers, and Levy agrees there is no point in lecturing young women, “because it doesn’t do anything, and they know it already. They’re like, ‘Eff you: I’m busy trying to earn money and figure myself out.’ It’s just a design flaw that, at the exact moment so many of us finally feel mature enough to take care of someone beside ourselves, the body’s like: ‘I’m out.’”

At home in New York: ‘I was a mess for a long time.’ Read an extract from her new memoir below. Photograph: Annabel Clark/The Guardian

In the UK and US, the average age of first-time mothers has climbed consistently for the past 40 years, partly because of the decline in teen pregnancies, but also because feminism has given women options beyond marriage and motherhood in their 20s. This, Levy says, “is a seismic rejiggering, and the cost can be epic”. While not all women want children, many do eventually, and it doesn’t matter how many articles you read about women who are childfree and fabulous – when the desire hits, it grabs by the root. That much has not changed, even if the age at which it comes has.

It feels almost treacherous to say this, I say, given how hard our mothers fought to give us more options than they had.

“I was never any good at keeping secrets,” Levy says. “I mean, we see the problem all around us. All of my friends had some nightmare experience trying to get pregnant. My story took the cake, but it wasn’t pretty for anyone.”

In the book, Levy suggests it was being a writer that encouraged her to think she could choose motherhood when she wanted: “[Writers] are accustomed to the power of authorship… you control how the story unfolds.” But I tell her I see the writer side of her more in her self-recrimination, the idea that she was to blame for the loss of her child because she waited too long to conceive. Although it is above the average age for first-time motherhood (in the US, this is 26; in the UK, 29), 37 is not crazily old to get pregnant. According to the NHS, 82% of women aged between 35 and 39 will conceive within a year if they are having regular unprotected sex. Levy was in a different situation, because she was relying on IVF. Is it easier to ascribe self-blame, or even societal blame, than say she simply suffered terrible luck in tricky circumstances?

“Well, it’s not just bad luck, because you are more likely to suffer from bad luck if you’re older,” she says. “But who knows? This might have happened to me if I’d got pregnant when I was younger. I just would have had more time afterwards to get pregnant again.”

***

Levy grew up believing the rules existed to be defied. As a child in pretty Larchmont, New York state, her mother’s “special friend”, a large African-American named Marcus, would frequently come to stay with Levy and her parents, a pair of “diminutive Jews”. Sometimes Levy’s mother would go to visit him. “Marcus had the power to change my mother from a stern regulator of all food containing sugar into a giggling nymph pouring giant glasses of 7Up, as carefree as if it were carrot juice. It was terrifying to see her so happy,” Levy writes. Eventually, her parents divorced.

“They came out of the 60s, where people were experimenting with all kinds of things,” she says. “And they were going to reinvent marriage, and everything that was established was bullshit. So my mom was like, ‘I’m going to have everything. I’ll have this thing and I’ll have my domestic life, and neither will affect the other.’ She feels really bad about it. You know, it destroyed my family. But it’s not like I think, ‘Therefore convention is great and traditional families are perfect.’”

Because neither the traditional nor the less conventional approach guarantees happiness?

“Exactly.”

Levy got in touch with an ex, only to find she was now a trans man. He wanted a baby, using his eggs and her uterus

As she grew up, Levy occasionally “experimented” with women, but it wasn’t until she was 26 and fell in love with her first girlfriend, Debs, that she realised this was, in her words, “a definite thing”. “The narrative around [coming out] is that everything that preceded it was a lie. But that’s not true for me – I really dug my boyfriends. But when I was with Debs, I thought, ‘Oh, I’m totally a lesbian.’ Then I thought, ‘Oh, wait. You don’t have to choose – no one’s going to make you sign anything.’”

She met Lucy when she was 28 and Lucy 41, at a friend’s party, and fell for her instantly. They had a wedding in 2006 and were legally married the following year in San Francisco. A few years after, Levy, then 35, embarked on an affair.

Even as affairs go, this one really broke the rules. Levy had got back in touch with an ex-girlfriend, Jen, only to find that she had since transitioned and was now a trans man named Jim. The sex was as good as Levy remembered, but on a personal level Jim infuriated her: he suggested the two of them have a baby together using his eggs and Levy’s uterus, a concept she found “repellent” in its blithe presumption: “It was his sense of entitlement – his belief that you could just keep choosing whatever you wanted in life, without ever sacrificing a single thing,” Levy writes.

But this was really a form of self-reproach: she wanted to be married, but also to have an affair; she had tried to forge her own path, but ended up replaying her childhood; she wanted to delay motherhood, but not reject it entirely.

Levy finally cut Jim off, and she and Lucy repaired their relationship. Soon after, Lucy’s alcoholism overwhelmed her, and she attempted suicide. But the two of them came through it; I met them soon after, when they couldn’t have seemed more together. They decided to have a baby. This, Levy thought, would be their happy story.

But happy stories come in unexpected shapes. Soon after Levy returned to New York from Mongolia, suddenly with neither a spouse nor a baby, she got an email from John Gasson, the South African doctor who had looked after her in Ulaanbaatar. He sent her her medical report, which stated unequivocally that flying to Mongolia had played no part in the loss of the baby, “just in case you have any lingering doubt or feelings of guilt”, which she did. The two began to correspond, “and that was a lifesaver, because he was the only one who saw me with the baby, and that was the only thing that felt real to me then,” Levy says. Emailing turned into visits. Visits turned into something more, and they are getting married next year. “This relationship feels less conventional than my relationship with Lucy: we don’t live in the same country, we have different lives. My straight relationship is a lot less straight than my gay one was,” she says.

Levy only hints at this relationship in her book, and I tell her I was amazed that she resisted concluding with this better-than-Hollywood happy ending. “Well, I didn’t want the book’s message to be, ‘Someday, my prince will come’, because it wasn’t like that. I was a mess for a long time. There’s no such thing as a happy ending. And this isn’t an ending – I mean, I’m not dead.”

The real lesson of Levy’s story isn’t that women are having children later and that this is a problem, but that women’s lives are now an entirely different shape, with happiness no longer dependent on the old markers. A woman can marry another woman in her 30s, and then a man in her 40s; a woman can run for president in her 60s. And even if they don’t get the original intended prize – the baby, the presidency – the forging of that new path still feels in itself like a triumph. But I suspect it will be some time before Levy will be able to tell that story.

She has always loved to garden; her roof terrace was always bordered by shrubbery, and these days she has vegetable and flower beds. “If I had my way, it’s the only thing I’d ever do,” she says. In South Africa, she has learned to horse ride along the beach: “I like how it feels like flying.” When we meet, she is just finishing up a New Yorker profile of the artist Catherine Opie, whom Levy describes as “a feminist and visual poet on gender”.

As for herself, Levy remains first and foremost a feminist, but one who has moved on from Female Chauvinist Pigs: “I still agree with myself that reducing women to tits and ass isn’t this liberating thing. But I’m just not that interested in talking about porn and whatnot at this moment in time. I don’t know if it’s because I’m older, or because the world has changed and we’re in a genuine crisis about women’s rights with Trump.”

Last summer, Levy decided, after four long years, to stop the fertility treatments. “I just need my life not to be about what I don’t have, or consistently failing to get it in the most painful way. And it’s great. I mean, you can’t spend the month of January in South Africa riding horses on a beach and be like, my life sucks. All choices mean not choosing something else, and if the kid thing doesn’t work out, John and I can travel when we like, and that has its charms.

“I feel like we’re not supposed to admit to regret about our lives, but I do have regrets, and that’s fine. That doesn’t mean I can’t live with them, or that something’s wrong. And it’s pretty great when I can hand my friends’ kids back when they start having a tantrum. Just as you won’t lie to me and say there’s nothing fulfilling about motherhood.”

A decade ago, Levy profiled the New York Times columnist Maureen Dowd, and asked her if she regretted not having had children. “Everybody doesn’t get everything,” Dowd replied.

“That sounded so depressing to me at the time,” Levy says. “Now it just seems like a relief to know I don’t have control over everything. It’s a part of growing up.”

Another part is learning that the rules are mutable: you can be divorced and still love your former spouse; sadness is part of a happy life; and feminism doesn’t mean getting everything. It means giving women choices and that’s a good thing – even if sometimes those choices are taken away.

‘Dr John asks how I am feeling. I tell him that I am in hell’: an exclusive extract from Ariel Levy’s new book

An email arrives from Dr John Gasson, medical director, SOS International Clinic, Ulaanbaatar. As promised, he has sent my medical report, which I need to submit to my insurance company. He has also attached a study on preterm birth that he mentioned when we were in the clinic.

I ask him if it is normal that I’m lactating. He explains that the oxytocin that brings on contractions also signals the body to lactate. He adds that the “milk letdown reflex after a miscarriage is one of nature’s less kind tricks”, which I think is an elegant and apt way of putting it.

Dr John asks how I am feeling. I tell him that I am in hell. But the very fact of him asking, of being in communication with the person who was there that night, is a balm beyond any other.

I thank him for being so kind to me at the clinic. I ask if it’s gotten even colder in UB. He says that it has, but that the real problem is the pollution: the colder it gets, the more garbage and coal people burn in the streets for warmth, and the harder it becomes to breathe.

He explains that for six months of the year, he lives on the other side of the world, in South Africa, in a cottage he built himself. There is a stable there that he put up for his horses, and next door, his two teenagers live with their mother and her second husband. “I do miss my kids and horses when I am away, and that can be difficult,” he writes. “The kids will be leaving school soon and off to university. Then I will just have the horses to miss.”

I tell him about the time I spent in Cape Town. I describe my meeting with the track team out in the wind in Limpopo, my encounter in Pretoria with Caster Semenya.

Actually, he knows that story: he has been reading some of my articles online. He says he likes the way I write.

I like the way he writes, too: “One of my father’s better stories involved being woken up in the early hours of the morning and leaving in some haste as the house was burning. He remembers himself and his younger brother peering through the back window of the motorcar, still in their Victorian nightdresses, as the night sky lit up over the rapidly receding town of Barberton. The veracity of his account is suspect, but what is fact is that some very incriminating documents conveniently disappeared in the fire.” His sentences are so jaunty! And so foreign. They sound like they were written in not just another place, but another time. His stories transport me.

Dr John tells me about his childhood in Zambia and Zimbabwe – Rhodesia, to him, at the time. Growing up, he didn’t question why, if they were Englishmen, as the people they socialised with considered themselves to be, they lived in a country where everyone else spoke Shona and Ndebele. He did not really contemplate what it meant that his father – also a doctor – and his grandfather before him were colonialists, until many years later when he began to question everything he’d been taught about blackness, whiteness and where he belonged.

His brother, Greg, was his best friend; they were only two years apart in age. Their mother died when they were toddlers. Greg died, too, in a motorcycle accident when he was 21. I can feel how haunted Dr John Gasson was – is – by that loss from 6,000 miles away. His mother, his brother, his father, his country no longer exist, are part of the past.

I wonder sometimes if my grief is disproportionate, inappropriate

When we converse in writing, everything feels complete, discrete. I don’t have to explain what just happened; he was there. Within the confines of our epistolary friendship, I am not missing pieces of my life – except the one that came from my own body, the one that Dr John alone has seen. Not a picture of the piece, the person.

I wonder sometimes if my grief is disproportionate, inappropriate. “I saw my father fall apart after my brother got killed,” Dr John tells me. “But he had the consolation of knowing the adult that my brother briefly became. You don’t even know what your son would have been like as a little boy. I feel desperately sorry for you.”

Only Dr John saw him, and only Dr John saw me with him. Only Dr John saw what feels so violently true to me, I can’t stand that it is invisible to everybody else on Earth: here is a mother with her baby who has died.

And so, in one way, our friendship is a kind of fiction.

We are two people on opposite ends of the Earth, who do not know each other, who write each other emails as if we are familiars. (At first, we just exchange a few, here and there. But soon we are writing regularly. And the first thing I do when I wake up after I stop crying is check to see if he has sent me an email full of stories about places I have never seen, in a voice that is swashbuckling but somehow intimate.) In another way, these emails – and that picture – are the only things that are real to me.

• This is an edited extract from The Rules Do Not Apply, by Ariel Levy, published on 16 March by Little, Brown at £16.99. To order a copy for £12.74, go to bookshop.theguardian.com or call 0330 333 6846.