Think of Bernie Sanders’s rising primary challenge to Hillary Rodham Clinton as part ideology, part technology. But don’t forget a shift in Democratic psychology, either.

The ideology part is his call for a “political revolution” that redistributes wealth from the “billionaire class” to average Americans, thrilling many Democrats in an era of widening income inequality. The technology part is the damage Mrs. Clinton has suffered from questions about her email, while Mr. Sanders’s campaign excels in its use of social media.

With less notice, the competitive psychology of presidential elections has also changed in ways that make it easier for an aging, tousle-haired socialist to attract Democratic votes and donations. Once beset by anxiety over their electoral prospects, Democrats increasingly feel they have the upper hand in White House races.

“It’s night and day,” said Mr. Sanders’s campaign strategist, Tad Devine, who began his career tracking delegates for President Jimmy Carter’s doomed 1980 re-election bid. “The Democratic advantage is substantial.”