Thousands came to a signing for former president Bill Clinton’s memoir, “My Life” at a Harlem bookstore in 2004. (Mario Tama/Getty Images)

Tevi Troy is a former senior White House aide and the author of “What Jefferson Read, Ike Watched, and Obama Tweeted: 200 Years of Popular Culture in the White House.”

According to literary agent Andrew Wylie, President Obama’s post-White House memoir could fetch an advance of up to $20 million . First lady Michelle Obama’s memoir, which she has apparently already started, could bring in an additional $12 million — not a bad nest egg for their golden years.

Presidents have long relied on memoirs to secure their financial futures. Calvin Coolidge got a $65,000 advance, back when that was real money, and every presidential memoirist since Ronald Reagan has received well beyond $1 million for his recollections. But money is just one factor in the decision to write a memoir, and not necessarily the most important one. Much like a presidential library or a new foundation, the post-presidential memoir is an effort to influence history’s verdict. Through these books, presidents try to retell their stories, recast their decisions and redefine their legacies — competing with the journalists, historians and former staffers who will try to do the same.

So, can a memoir bolster, or at least salvage, a president’s reputation? As it turns out, successful presidents don’t always produce successful books, and unsuccessful presidents have often produced books that are better than their administrations. When it comes to legacies, though, the best works do provide human insights that can soften history’s harshest judgments — but rarely overturn obvious ones.

Ulysses S. Grant offers the first and in many ways the most fascinating example of a memoir succeeding in getting an ex-president’s finances in order but failing to alter popular perceptions of his tenure. In 1884, Grant went bankrupt after he experienced heavy losses from investments in his son’s firm, Grant & Ward. Battling terminal throat cancer, the former Union general was desperate to leave money behind for his family. So he began work on a memoir with the assistance of Mark Twain. Eventually, Grant lost the ability to dictate because of his illness and frantically handwrote pages so he could finish. He finally completed the manuscript just a few days before he died, on July 23, 1885.

The “Personal Memoirs of U.S. Grant” electrified the public, selling more than 300,000 copies, and provided Grant’s widow, Julia, with an estimated $500,000. The book also proved a stylistic masterpiece. Its concise and bold opening — “My family is American, and has been for generations, in all its branches, direct and collateral” — is echoed in Saul Bellow’s classic novel “The Adventures of Augie March,” which begins, “I am an American, Chicago-born.” Historian David Levering Lewis wrote in 2009 that “Grant’s presidential memoir is the best of the genre, unparalleled to date.”

His successors have taken that assessment to heart. Dwight Eisenhower admired Grant’s “lack of pretension” and modeled his own memoir on Grant’s book. Similarly, George W. Bush looked to Grant’s work in preparation for his memoir, writing in “Decision Points” that he followed Grant’s lead in choosing “not to write an exhaustive account of my life or presidency,” focusing instead on certain key decisions he made while in office.

Yet Grant’s memoir, about his Civil War experience, did little for his reputation as president in the short run. His time in office has long been known for the scandals that beset it, such as the Whiskey Ring tax scandal. Grant typically ranks low on historians’ lists of best presidents. A 1948 ranking had him at 28th out of 29 presidents, and a 2000 C-SPAN poll had him 33rd out of 41. In more recent years, however, Grant has been inching up the ladder — he reached 23rd in a 2009 ranking — and the memoir, so lavishly praised by historians, might be a point in his favor.

Harry Truman’s written reflections were also driven by financial need. Truman had little in his bank account after leaving the Oval Office and needed his $670,000 advance to support himself. After taxes and wages for his assistants, the cash did not last long, though, and in 1958, Congress passed the Former Presidents Act, providing a $25,000 pension for ex-commanders in chief.

The first volume made a splash when it came out in 1955, and it was serialized in the New York Times and excerpted in Life. But it had little impact on Truman’s reputation; he left office as an unpopular president dogged by the Korean War and paling next to Eisenhower. The renewed appreciation of Truman’s legacy has been driven far more by a post-1970s revival — culminating with David McCullough’s 1992 “Truman” — than by Volumes 1 and 2 of his memoirs.

In more recent decades, million-dollar advances and publishers’ PR teams have boosted the profile of post-presidential memoirs. Lyndon B. Johnson scored a $1.6 million deal for his memoir, including a $1 million advance. Yet “The Vantage Point: Perspectives of the Presidency, 1963-1969” earned back only $600,000. According to journalist David Halberstam, when publisher Holt, Rinehart and Winston expressed interest in a second volume, as called for in the contract, Johnson replied that by delivering a 300,000-word book, he had already fulfilled his obligation for two books of 150,000 words.

The book itself, largely ghostwritten, felt sterile compared with its larger-than-life protagonist. It “read like a parody of a presidential memoir,” historian Michael Beschloss wrote in Texas Monthly in 2001. Johnson’s book also encountered a relatively new phenomenon: competition with the memoirs of White House aides. George Reedy, Harry McPherson and Jack Valenti all wrote their own interpretations of the Johnson years, as did Lady Bird Johnson with “A White House Diary” — and LBJ’s book did not hold up well in comparison. Overall, it did little to redeem his reputation, marred as it was by Vietnam. And now, Johnson’s legacy is being shaped almost entirely by Robert Caro’s magisterial multi-volume biography, which paints LBJ as a potent politician — especially in the Senate — but an unlikable person.

No doubt, Richard Nixon was seeking reputational redemption when he published “RN” in 1978. But he needed financial assistance as well: His $2.5 million advance helped offset his $1.8 million in outstanding legal fees. “RN” was an impressive achievement — well-written and based on extensive notes Nixon had taken while in office. At the same time, it was too long, and while it did not dodge the subject of Watergate, it did appear to dodge responsibility for it. As for Nixon’s reputation, some holes are too deep to dig out of, even with a 1,100-page book. Economist John Kenneth Galbraith dismissed the memoir in the New York Review of Books, writing that its “central theme” was that “Nixon never did anything wrong unless someone else had done something like it first. And all evil disappears if it has a precedent.”

Of course, journalists Bob Woodward and Carl Bernstein posed a bigger challenge to Nixon’s historical rebranding efforts than highbrow negative reviews. Their books “All the President’s Men” and “The Final Days” — not to mention the movie version of the former — did far more to cement public perceptions than Nixon’s memoir. Even the best memoir could not overcome the combination of the “Woodstein” portrayals and the steady revelations about the president’s nastiness in the White House tapes.

With fewer financial or reputational worries than Nixon, Ronald Reagan appeared to put less effort into his memoir. “An American Life” was not a financial success; poor sales may have stemmed from the fact that the book was ghostwritten, “and it showed,” Simon & Schuster’s Michael Korda said in 2007. Reagan never quite admitted this, but he did joke about the idea. “I hear it’s terrific,” he quipped at a news conference for the book’s 1990 launch. “Maybe someday I’ll read it.”

Reagan’s laissez-faire attitude toward his autobiography, along with the bizarre 1999 authorized biography of Reagan by Edmund Morris — with a fictionalized Morris serving as narrator — means that efforts to reshape his legacy through books have been left to others. Reagan had to contend with memoirs from former aides, such as Donald Regan and David Stockman, that included embarrassing revelations about the Gipper and his White House. Fortunately for Reagan, conservatives continue to produce countless positive bios, and liberal authors’ treatments — such as Richard Reeves’s “President Reagan: The Triumph of Imagination” — have softened toward him over time.

Still, it’s a risky strategy, and future presidents would be wise to take better advantage of the legacy and PR opportunities provided by the memoir and the authorized biography than Reagan did.

Bill Clinton went a more traditional route with his autobiography, although in a self-indulgent way. “My Life,” for which he secured a record-setting $10 million advance, went on for 950 pages. The memoir, however, opened windows on Clinton’s thinking, including a detailed accounting of the many books he had read, such as Sen. William Fulbright’s “The Arrogance of Power,” which shaped his views on Vietnam; Gabriel Garcia Marquez’s “One Hundred Years of Solitude,” which a Yale law professor caught him reading in class ; Ernest Becker’s “The Denial of Death,” which he read on his honeymoon; and Richard Preston’s “The Cobra Event,” which he recommended to Newt Gingrich.

Like Nixon, Clinton did not shy away from his most famous major scandal, the Lewinsky affair, but also like Nixon, he was happy to cast blame elsewhere. Still, the 2004 book sold more than 2 million copies and became part of Clinton’s post-presidential emergence as one of America’s most popular politicians. As Hillary Rodham Clinton gears up for her near-certain presidential run, the former president will probably be deployed as a popular surrogate.

George W. Bush has written the most recent presidential memoir. His $7 million advance for “Decision Points” was considerably smaller than Clinton’s and probably Obama’s as well, in part because of Bush’s low popularity upon leaving office. The book sold more than 2 million copies, though the reviews appeared largely divided along ideological lines.

I suspect that one of the reasons the book succeeded was that it seemed to mirror the real Bush, for whom I worked as a White House aide. The volume was plain-spoken and humorous. In one of my favorite passages, the president explained that he “knew the Bushes and the Blairs would get along” when, during a visit by Britain’s Tony and Cherie Blair to Camp David, both couples agreed to watch the comedy “Meet the Parents.”

Another factor shaping his ­post-presidential image is the glut of often-clashing memoirs from high-level Bush officials. Donald Rumsfeld , George Tenet, Doug Feith , Colin Powell, Robert Gates, Condoleezza Rice and Paul Bremer all penned memoirs, and that’s just in the national security arena. Most of the memoirs from administration veterans, even the snarkier ones, tend to treat Bush well, aiming their ire at other officials with whom they disagreed. Notable exceptions are the more negative works by former White House press secretary Scott McClellan and former speechwriter Matt Latimer.

Overall, though, the main purpose of staff memoirs is to provide rich material for historians and journalists. For instance, in his recent book “Days of Fire,” examining the partnership between Bush and Vice President Dick Cheney, New York Times reporter Peter Baker skillfully weaves together recollections from different Bush administration memoirs to form a coherent narrative — particularly on the administration’s response to the Sept. 11, 2001, attacks, where Baker has produced what may be the definitive account.

Bush has seen an increase in his popularity since leaving the presidency — he is up to a 47 percent approval rating — as the American people appear to come to appreciate both the extent of the challenges Bush faced and his willingness to step back from the limelight and not criticize his successor.

The spotty history of presidential memoirs should cause future presidents to think carefully about how to approach their literary efforts and what they can realistically hope to accomplish. It seems clear that while a bad memoir can hurt a reputation, there is a limit to how much even a well-done book can accomplish. At the very least, they should realize that an authentic retelling, in their own voices, can help in the long run with historians.

Obama faces some hurdles in writing his post-presidency memoir. Expectations will be ludicrously high, not just because of the probably enormous advance but because his first memoir, “Dreams From My Father,” received so much praise, and justifiably so. He also faces such a polarized electorate that it is unlikely anything he writes will sway anyone on, for instance, the merits of the Affordable Care Act or his handling of the economy. His second book, the more policy-focused “The Audacity of Hope,” was disappointing compared with the first, suggesting that readers might be more interested in his life story than his controversial policies.

Presidents be warned: You can bank on memoirs for money, not for salvation. Some of our most consequential and respected presidents never wrote memoirs, including Franklin D. Roosevelt and John F. Kennedy, both of whom died in office, and Woodrow Wilson, who suffered a stroke toward the end of his White House tenure. Sometimes less is more. The martyred Kennedy never had the opportunity to write a memoir but continues to captivate America’s imagination. And as biographer A. Scott Berg noted, when Wilson was asked about the possibility of writing one, our only president with a doctorate responded colloquially: “There ain’t going to be none.”

Read more from Outlook, friend us on Facebook, and follow us on Twitter.