Here is a piece from Pacific Standard which quotes the following explanation:
"When a candidate is perceived as adhering to a set of religious values, voters see them as moral and possessing high levels of integrity and honesty," write political scientists Scott Clifford of the University of Houston and Ben Gaskins of Lewis & Clark College. "Such perceptions ultimately translate into increased political support for these candidates."
[...]
Clifford and Gaskins also analyzed a 2007 CBS News poll, focusing on attitudes toward Hillary Clinton. Participants were asked whether they were likely to vote for her, whether she has "strong religious values," and whether she "has more honesty and integrity than most people in public life."
They found that "perceived religiousness has a positive significant effect on favorability, increasing the probability of favorable views of Clinton by 20 percentage points." Not surprisingly, the association between religiosity and trustworthiness was higher among conservatives and moderates, which means "expressing religious identity may be a key strategy to broadening her political coalition."
What's more, they found she pays no price for doing so: Even secular liberals are "more likely to view her favorably and vote for her if they see her as religious."
The article goes on to mention that secular liberals were perhaps 7% of the general population, which gives further support to the idea that professing religious faith is politically costless, or at least nearly so.
A different group of researchers has a book called God Talk that includes a chapter with the title, "Why People Will Not Vote for Atheist Candidates". I've not been able to track it down yet but it may give further insights.