I was in the Navy and during my time I needed a background check to get the required security clearance. How does this work with elected officials? Can the president of the United States, senator, or representative fail this check, if they are required to have it at all?
Presidential candidates receive (some) classified information without needing further background checks. General Clapper, then Director of National Intelligence is quoted by Time (in relation to classified briefings for then candidates Trump and Clinton):
Speaking at the Aspen Security Forum, Clapper noted that there is no security clearance required for the briefings. “The fact that they’re a candidate qualifies,” he said, adding it would be inappropriate if it were otherwise. “And I’ll tell you really it’s not up to the administration and certainly not up to me personally to decide on the suitability of a presidential candidate.”
As for the president, according to a letter by a specialist in Intelligence in National Security for the Foreign Affairs, Defense and Trade Division to Senator Feinstein:
By virtue of his constitutional role as commander-and-in-chief and head of the executive branch, the President has access to all national intelligence collected, analyzed and produced by the Intelligence Community.
Other elected officials
However, there is not a specified background screening program for politicians. During every election cycle, candidates from all parties and walks of life have been caught hiding embarrassing information from the voters.
The topic of security clearance for elected officials has long been a complex one. Members of congress – even those in sensitive committee positions – do not receive or obtain security clearances in the same way that a member of the public would go about obtaining a security clearance based on job or military requirement.
However, staff do need clearances, from the same link:
House and Senate staff members with a need to access classified information are required to obtain security clearances. The Office of Senate Security and Office of House Security, respectively, have oversight over the security clearance process for congressional staffers, and background investigations are conducted by the FBI.