Does the U.S. president have to disclose their religious beliefs to the public? Let's say that the President is a member of an unpopular religious group. Do they have to disclose that fact to the public, or is that information confidential and protected?
Legally, no. Article VI of the Constitution specifically says
no religious Test shall ever be required as a Qualification to any Office or public Trust under the United States.
So the government itself can't require any specific religious affiliation of POTUS.
But voters are not constrained by this. As other answers point out, many voters consider religious belief an important aspect of the candidate's character. Religious conservatives would rarely vote for an atheist. And even though the US is majority Christian, there's suspicion between denomination; Kennedy was and Biden is Catholic, and this raised concern among other denominations that this would give the Vatican undue influence, although not enough to prevent them from winning.
If a candidate didn't disclose their religion, voters who care would likely assume the worst -- "what are they trying to hide?"
As a practical matter, it would be quite difficult for a public figure to completely hide their religious affiliation. If they refused to disclose it voluntarily, this would just increase the resolve of reporters to investigate, and it will get out. While some voters might admire the candidate for standing their ground and protecting their privacy, the aforementioned voters who care about the candidate's religion will mostly feel that they're being deliberately evasive.
This is not too different from candidates publishing their tax returns. There's no legal requirement, just a tradition. But voters will wonder why they're evading the practice if there are no black marks there. Of course, as we've seen in one recent election, a persuasive enough personality can overcome this. But I think religion is a much more emotional area, so I doubt a candidate could make similar excuses not to disclose this and get away with it at the ballot box (but who knows? -- Trump claimed he could kill someone in Times Square and still get elected, and I almost believe that).
They do not.
One's affiliation with a religion is a private matter - and actually impossible to determine objectively save by the person who holds the affiliation. The information isn't confidential/protected, either, however. One's religious beliefs may be inferred from the organizations one associates with (i.e. what church you go to), or lack thereof. It is not impermissible to share information about someone's public affiliations.
But this information is not formally gathered anywhere.
American political tradition makes it very likely that a candidate for President of the United States who does not disclose a religious affiliation will be viewed with suspicion: historically anti-Catholic sentiment used to play a role in electoral politics, and anti-atheist sentiment in many areas of the U.S. But for Constitutional reasons, this information is not disclosed anywhere until/unless one claims a religious affiliation in order to resist a governmental restriction against the practice thereof: which is where most of the Free Exercise clause jurisprudence comes from.
Short answer: No.
Long answer: Yes.
The reason why the long answer is yes (and also why it's a long answer) is as follows:
A large number (statistically significant number) of Americans identify as religious, in one way or another, and specifically as Judeo-Christian. A statistically significant number of those people believe that what are commonly known as "traditional values" are important in an elected representative. A statistically significant number of those people believe that, to varying degrees (whether they believe this about atheists, agnostics, pseudo-religions like Scientology, or simply any non-Judeo-Christian religion such as Hinduism, Buddhism, Shintoism, even Islam which is technically Judeo-Christian, etc, varies), those who do not follow a Judeo-Christian religion do not share those traditional values, at least not as strongly as those people would like them to.
Now, it is not required that a President disclose their religion. It is not even required that a President be religious. However, it is the case that if a Presidential candidate does not disclose their religion, or discloses their religion to be something other than Judeo-Christian, that they will automatically lose a statistically significant number of voters on that basis alone (see also, the campaign against Barack Obama vis-a-vis being a "closet Muslim"; whether you believe that campaign to be silly, or justified, or racist, or whatever, it is undeniable that it got significant traction amongst a statistically significant demographic). It is therefore in the best interest of any major political campaign to have their nominated person be (or pretend to be, at least) a practicing member of a Judeo-Christian religion.