Stewart O’Nan’s 15th novel, West of Sunset, due out from Viking in January 2015, imagines F. Scott Fitzgerald’s final years in Hollywood writing screenplays for MGM to support his family: his wife, Zelda, who was mentally ill and receiving care at a sanatorium in North Carolina, and their teenage daughter.

Fitzgerald lived at the Garden of Allah, a Sunset Boulevard hotel popular with celebrities, and fell into a tumultuous love affair with gossip columnist Sheilah Graham. He battled alcoholism and depression and died of a fatal heart attack in December 1940 at Chateau Marmont.

Fitzgerald left behind the incomplete manuscript of a novel, which was first published under the title The Last Tycoon in 1941 and reissued in 1993 by Cambridge University Press as The Love of the Last Tycoon. That book inspired O’Nan’s latest effort. He says of The Last Tycoon: “It’s a romance about a man who knows he’s lost and then finds himself again. It’s a story about love, and regret, and second chances—there are lots of wild pool parties, cocktails, and dancing beneath the stars.”

While Fitzgerald’s biographers lament the fact that the great novelist spent his last years writing screenplays, O’Nan points to the fact that filmmaking involves many types of creative workers whom Fitzgerald collaborated with in Hollywood, plus his (uncredited) work on such classic films as Gone with the Wind. “It’s the golden age of the studio system, and he’s in the thick of it, and madly in love,” O’Nan says. “He was happy, because he knew that the book he was writing was good. For a writer, that’s all that matters.”

O’Nan says he was inspired to take on the “audacious” project of writing a fictional biography of Fitzgerald during his Hollywood years by photos of the writer that he came upon while researching an unrelated project “with a Hollywood component.” He adds, “I didn’t really know the story. I found that there were all these gaps.” O’Nan also noticed that Fitzgerald’s correspondence and Graham’s memoirs often contradict one another. “He became more legendary and more mythical because no one could agree on what he was actually doing [in Hollywood] or how he felt.” And these disparities are all the more glaring because the rest of Fitzgerald’s life is so well documented.

“There’s a story here that hasn’t been told,” O’Nan recalls thinking as he combed through Fitzgerald’s correspondence and the memoirs and diaries of his friends and family. As he talks about West of Sunset, he emphasizes that he wrote his fictional account from Fitzgerald’s perspective, rather than from that of a Nick Carroway–like narrator, in order to get closer to his subject. O’Nan is adamant that, other than in some fictionalized letters included in the novel, he did not even attempt to write in Fitzgerald’s voice, but instead wrote “using his sensibility.”

“My interest in Fitzgerald is how he was feeling, what he was going through,” O’Nan says. “How did it feel to be this particular person behind the headlines? When everyone else has gone away and he’s left by himself—that’s the most interesting part. To [get] inside of him—that’s the risk, the challenge; that’s what I love to do.”

O’Nan says that he prefers writing fiction to nonfiction because he “likes making things up.” Imagining the minutiae of a well-known historical character’s life is “daunting” and even “very dangerous,” he says, but there are “exterior clues” that can be culled from letters, photographs, and other primary and secondary sources. Certain scenes in West of Sunset may not have actually taken place, he admits, but they are “inevitable, possible, and probable” incidents.

In addition to digging through the archives, O’Nan visited the places where Fitzgerald lived—all except for Los Angeles. He didn’t want the city of the present to intrude upon his sense of the city as it was in the 1930s. He also “read and reread” Fitzgerald’s five novels and all of his short stories.

O’Nan, 53, was born and raised in Pittsburgh, Penn., where he currently lives. He worked on Long Island for five years as an engineer for Grumman Aerospace Corp. after graduating in 1983 from Boston University. “My wife, Trudy, convinced me that, because I was spending all my time writing, I should become a writer for real,” he says.

O’Nan quit his job and enrolled in Cornell University’s M.F.A. program, receiving his degree in 1992. It was difficult for him to walk away from a lucrative engineering career when he had a mortgage to pay off and two young children to raise.

O’Nan describes the relief he felt when his first book, The Walled City (Univ. of Pittsburgh, 1993), his only collection of stories to date, won the $10,000 Drue Heinz Literature prize in 1993. The novels O’Nan has written since—including Snow Angels (Doubleday, 1994), Speed Queen (Doubleday, 1997), and A Prayer for the Dying (Holt, 1999)—span a variety of genres, because, he says, he writes about whatever intrigues him, trusting it will draw in readers.

“I haven’t been put into a box,” O’Nan says. “I don’t have to write a mystery novel; I don’t have to write a war novel. I can just write what I want to write. That’s the dream.”

For O’Nan, writing begins with research, and lots of it. “I’ve always been like that—very obsessive in gathering things.” The initial inspiration can come from anywhere: “Sometimes it’s a person I meet, or a story I hear, or six or seven things will all conjoin. I try to research toward that; I try to write toward that.” Sometimes it pans out, O’Nan says; other times it doesn’t. “You get 100 pages in, and you never look at it again.” And, he adds, sometimes the book he ends up writing is completely different from the one he thought he was going to write.

O’Nan’s fascination with the 1946 bombing of Jerusalem’s King David Hotel by an underground right-wing Zionist organization inspired his novel in progress “about terrorism,” set in 1940s Palestine. Showing off 150 marked-up pages, he says that he keeps the manuscript with him wherever he goes so that he can work on it at any time. The new project is typical of O’Nan’s work in that it involves a character whose life is “thrown out of balance.” He notes, “That character has to figure out how to get back to balance.... It’s a little scary, but I usually figure it out.”

Correction: An earlier version of this profile stated that Fitzerald died in the Chateau Marmont Hotel in Los Angeles; in reality, as O'Nan reports, "Fitzgerald died of a heart attack in Sheilah Graham's Hollywood apartment."