When I came to Dublin as a student in 1972, the writer Mary Lavin was a familiar presence in the city. I watched her as she moved with a sort of stateliness between the desks in the National Library on her way to the main desk, or as she sat in a small cafe known as the Country Shop, or as she drank coffee in Bewley's in Grafton Street. She was usually alone. She wore black. Her hair was parted in the middle and pulled untidily into a bun at the back. Her gaze was kind and sad and oddly distracted, but it had a funny strength to it as well. She had spent her life describing others, and finding strategies to create versions of herself; it was not easy to categorise her or ever be sure about her just from looking.

I have no clear memory of how I knew that she had been left a widow with children at a young age, but I certainly knew it before I came to the city. I was interested in the word "widow" and I would have paid real attention to a writer, or anyone at all indeed, who was a widow, since my mother was one. It may have been when we studied a story by Lavin in school called "The Widow's Son".

I had read a good deal of her work by the time I saw her. Some of her stories meant nothing to me. The scenes of upper middle-class life in County Meath, north of Dublin, were too rarefied. But the ones that dealt with the life of a widow were almost too close to the space between how we lived then in our house and what was unmentionable – the business of silence around grief, the life of a woman alone, the palpable absence of a man, a husband, a father, our father, my father, the idea of conversation as a way of concealing loss rather than revealing anything, least of all feeling – for me not to have read her with full recognition. The recognition was so clear, in fact, that I do not remember recognising anything. I was reading with too much rawness.

But I must have sat up when I came to this passage in Lavin's story "Happiness": "When Father went to hospital Mother went with him and stayed in a small hotel across the street so she could be with him all day from early to late. 'Because it was so awful for him, being in Dublin,' she said. 'You have no idea how he hated it.' Maybe I thought this would be in other books in the future – such a precise image of what had happened to us – but I never found it again. It was only there. It is in the novel I have written, Nora Webster, but it took me a long time to find a dramatic form for those words.

In Lavin's stories about solitude and widowhood, her characters live in a twilight time. They barely manage. One of her stories about grief and its aftermath, controlled grief, is "In the Middle of the Fields". In the first sentence, she establishes that her heroine is alone in an isolated rural place. And then the next sentence reads: "And yet she was less lonely for him here in Meath than elsewhere."

The loss is complex, or it comes in a complex guise. People think she wants to talk about her dead husband, or be reminded of what she has lost. "They thought she hugged tight every memory she had of him. What did they know about memory?" She hopes for a time when she had "forgotten him for a minute". It is clear that the grief does not have to be named as "grief", or brought out for inspection. All she knows is that how she feels is not stable, it cannot be trusted. It is wayward.

In Lavin's stories about loss the newly widowed woman has to remake the rules for herself, including the most ordinary rules of behaviour. Emotions dart, fresh longings emerge; what her characters do can easily become irrational and hard to explain; they often do the very opposite of what they intend. Being unmoored by loss affects their every thought, even when they are not thinking about loss, and, indeed, affects their every action.

This idea of the personality as suddenly protean under the pressure of loss belongs fundamentally to the literature of grief because, of course, it belongs to the experience.

I remember in school sitting at the back of the class soon after my father had died and listening to a discussion about Hamlet's madness and Hamlet's character and everyone wondering why Hamlet could in one second be in love, and the next out of love, and then angry and ready for revenge and then ready to procrastinate, the next minute melancholy and the next putting an antic disposition on, and why his tone could be so wise and then also so bitter and sharply sarcastic and rude. How could he be so many things, and how could we define his character?

I wish I had put up my hand to say that I thought I understood what was at the root of all his antics. His father had died not long before. That was all. He had been unmoored. While those around him were trying to explain that what had happened was normal, a part of nature, and were trying to get on with things, Hamlet had become wayward and, luckily, Shakespeare had seen the dramatic possibilities of this.

In the preface to her book Grief Lessons, translations of four plays by Euripides, Anne Carson muses on grief. "Why does tragedy exist?" she asks. And then replies: "Because you are full of rage." Then she asks: "Why are you full of rage?" The answer is: "Because you are full of grief. Ask a headhunter why he cuts off human heads. He'll say that rage impels him and rage is born of grief. The act of severing and tossing away the victim's head enables him to throw away the anger of all his bereavements. Perhaps you think this does not apply to you. Yet you recall the day your wife, driving you to your mother's funeral, turned left instead of right at the intersection and you had to scream at her so loud other drivers turned to look. When you tore off her head and threw it out the window they nodded, changed gears, drove away."

Susan Bullock as Elektra. Photograph: Tristram Kenton for the Guardian

A few years later, in her introduction to her translation of Sophocles' Elektra, one of the great plays about grief, Carson's tone seemed less certain as she wrote about the scene in which Orestes returns and hands his sister an urn with ashes which he says are of her dead brother Orestes. Orestes listens to Elektra mourn at some length before he announces that he was just fooling and that he has, in fact, been alive all the time and is now in front of her. Carson quotes the actor Fiona Shaw saying that she found the "deception/recognition scene between Elektra and Orestes 'unspeakably impossible to play'."

"Critics and scholars (and translators)," Carson goes on, "agree, this scene is a hard nut to crack. Why does Orestes decide to trick his sister into thinking he is dead? Why does he give it up in the middle? What does Sophocles want to achieve here? The alternation of lies and truth, high emotions and low, is bewildering and cruel, the tug of war over an empty urn almost bizarre." So, too, Philip Vellacott, who translated Euripides's version of the play, wonders about this scene and identifies the point "where Orestes should reveal himself … He does not reveal himself. Why?"

Surely the solution is simple. Surely Orestes' trickery is the very currency of grief. Orestes, having lost his father, is unable to come clean. The issues of life and death have entered his spirit and poisoned him so that his approach to re-meeting his sister will be all gnarled. He cannot deal simply with emotion. As Carson writes about Euripides's version of him: "All in all, Orestes is a peculiar customer – not exactly insane but strange and unknowable. His consciousness is entirely his own." Thus his response will be filled with doublespeak and trickery about the very things – the difference between being dead and being alive – that he cannot manage to come to terms with. Becoming "bewildering and cruel", as Carson puts it, and "bizarre", are what has happened to his personality under pressure. While his sister has been doing all the shouting, Orestes has let the pain seep silently into the very core of his being so that nothing he does will ever be easy to explain. While people are busy avoiding his sister because of what she says, they have been perhaps even busier avoiding Orestes because of his silence.

Some weeks after my father died, I went with my aunt into a house of an old friend of hers and my mother's to collect something. When my aunt said that my mother was in the car outside, the friend stepped backwards, making clear, without saying anything, that she was not prepared for this and would prefer if my mother remained in the car. I watched this and moved into the shadows. No one knows what to do in the presence of someone who has suffered loss, or what to say.

In his book A Grief Observed, published in 1961 after the death of his wife, CS Lewis described this very sense, in the aftermath of loss, of being someone to avoid. "An odd by-product of my loss is that I'm aware of being an embarrassment to everyone I meet … Some funk it altogether. R. has been avoiding me for a week … Perhaps the bereaved ought to be isolated in special settlements like lepers." In Julian Barnes's Levels of Life, written after the death of his wife, he writes: "So how do you feel? As if you have been dropped from a height of several hundred feet, conscious all the time, have landed feet first in a rose bed with an impact that has driven you in up to the knees, and whose shock has caused your internal organs to rupture and burst forth from your body. That is what it feels like, and why should it look any different? No wonder some want to swerve away to a safer topic of conversation. And perhaps they are not avoiding death, and her; they are avoiding you."

In Joyce Carol Oates's A Widow's Story, written after the death of her husband, she describes the efforts of her friend C. to throw an enormous dinner party for her, inviting many of her friends, to help ease the pain. "I envision," Oates writes, "a thirty-foot dining room table and at the farther end the widow placed like a leper, as far from the lovely C. as possible." Despite Oates's asking for a smaller event, C. persists, only to find of course that the friends are not free on any of the suggested nights. Oates writes: "I am beginning to realise that though C. has said that she and her husband are 'eager' to see me they are in fact dreading to see me."

The writing of Lewis and Barnes and Oates about grief is deeply personal, precise and particular. The feeling they describe is unique because the person grieved over was unique. The loss happened only once. But the writing is also public; it does not come in diary form with many cryptic references. Its source is perhaps the very source of fiction itself – the mysterious and compulsive need to find a rhythm and an artful tone to suggest and communicate the most private feelings and imaginings and facts to someone else, to make sentences which will move from mirroring the writer to allowing the reader to catch a more intense glimpse of the world.

Novelists make things up, but the things, or the feelings surrounding them, come from the world; they have a shape like the world's shape, or the shape, indeed, of experience, including the writer's experience or the writer's pressing concerns. Thus the experience of grief for a novelist makes its way into the work in the same way as the waters from the flood may be channelled into a living stream. Joan Didion's The Year of Magical Thinking and Blue Nights, the books about losing her husband and her daughter, and Francisco Goldman's Say Her Name, his book about the death of his wife, use with skill and subtlety the very gift for narrative which distinguishes the authors as novelists.

Michael Sheen as Hamlet. Photograph: Simon Annand

The novelists have become characters in their own books. By the urgency of the tone, they make clear, however, that, in the aftermath of loss, nothing they can invent compares to it. And that, since they are writers, what happened needs to be written down so that it can be known and shared and understood, so that it can lose its incoherence. And so that they, in their powerlessness and helplessness, can at least still do this, can at least write down what it was like.

For other writers, grief comes into the work more strangely and hesitantly, as though the flood water got trapped and began to seep into things. In the fiction of both Nadine Gordimer and Juan Goytisolo there is a steely emotional distance made palpable by the writers' intelligence and political concerns. How strange then to find in Gordimer's last book of stories a story called "Dreaming of the Dead", in which she dreams that she is having a meal with her old friends Anthony Samson, Edward Said and Susan Sontag, but all the time she is waiting for her recently dead husband, to whom the book is dedicated. "Did you come back last night? I try to dream you into materialisation but you don't appear," the story begins. And it ends: "I sat at the table, you didn't turn up, too late. You will not come. Never." And in between, his absence hovers over every gesture, every word, every thought.

Goytisolo's novel The Blind Rider is filled with the absence of his wife of many years, an absence mentioned in the opening pages merely as "her departure". Slowly, the glancing references to the loss, her death, give way to the most abject grief. As with Gordimer, the personal tone and the helplessness are all the more sharp and surprising because of their absence from most of Goytisolo's other fiction.

I began my novel Nora Webster in the spring of 2000. Even though I wrote other books over the next thirteen and a half years, I added to Nora Webster every year, or deleted something from it. I thought about it almost every day. Although some of the details are invented, including the details of the place where Nora goes to work, there is nothing invented about the atmosphere in the house in the small town where myself and my younger brother lived with my mother in the years after my father died.

I thought at first of writing the book from my own perspective, rather than my mother's, but when I tried to set some of that down, I found there was nothing, or not enough for a novel. It was as though the experience had hollowed me out and was, from my perspective, too filled with silence and distance for me to be able to harness it for a novel's purposes.

My father was a teacher in the town's secondary school. I knew the rooms he taught in because, as a student in the primary school, I often went over to his part of the school and waited for him to finish class. Now, five or six weeks after his death, I began for the first time to attend the school where he had taught. I sat in the classrooms where he had been at the blackboard. What is strange is that I have no memory of feeling anything; there was no drama, no obvious grief, just a blankness.

Slowly, his name ceased to be mentioned in the house. CS Lewis has a description of the same silence after his wife's death: "I cannot talk to the children about her. The moment I try, there appears on their faces neither grief, nor love, nor fear, nor pity, but the most fatal of non-conductors, embarrassment. They look as if I were committing an indecency. They are longing for me to stop. I felt just the same after my mother's death when my father mentioned her. I can't blame them. It's the way boys are."

What grows then is a strange and insistent watchfulness which gave me, among other things, total recall, so that there are scenes in Nora Webster which, down to the smallest detail – who was in the room, who said what, who looked at whom, who said nothing – are what happened. Once I realised that I could not tell the story from my own perspective, that I had no story, or one so filled with chaos and silence that it could not be rendered, then I saw that I could, because I had been watching and listening so fiercely, dramatise things from my mother's perspective, see things from her side. I could combine the tricks and strategies of fiction with the insistent business of fact. I knew enough to be able to imagine everything.

In the first chapter I wrote, Nora Webster decides never again to go back to the place on the Wexford coast where the family had spent the summers. I wrote a good deal of the book in that very place, not far from the house where we stayed then, the house we never went back to. The last chapter of the book has the most difficult and emotional scene. On a Saturday in the August of last year I got up at first light to write the scene. It had been in my head for so long.

I remember afterwards swimming in the sea, staying in the water for as long as I could. The scene was written. It would be lovely to say that I felt free of it all then, that by writing it down I had somehow erased it, or dealt with it properly for once, broken the silence. But writing requires such an amount of technical care, such cold deliberation, that it is not a form of self-help. The page is blank when you start; it is not a mirror. I wrote the novel because it was on my mind. I wrote it because what is on my mind has a habit of becoming rhythm almost of its own accord. But I knew, nonetheless, that this was probably something I would not come back to, so it should have been a relief when it was over, when it was written. But, as other writers who have described grief and loss must know, things are never as simple as that.

• Colm Tóibín's Nora Webster is published by Viking.