This year's presidential race and Donald Trump's success have shocked many established politicians, including former New York City Mayor Michael Bloomberg.

"Nobody thought he had a shot at this," Bloomberg told CNBC's "Halftime Report" Tuesday. "Trump marches to his own drummer it would seem, and so far, that drummer has been playing the right tune to get him this far."

Only history will tell if that tune will carry him to the finish line, Bloomberg said. One of Trump's tunes has tapped into a common fear voters may have about the current and future state of the country.

"They're worried about losing their jobs; they're worried about what their kids are doing," Bloomberg told CNBC at a BTIG Charity event. "They are looking for something different."

The same approach, he said, has worked for Democratic candidate Bernie Sanders although he noted that the "bookies and polls" predict Hillary Clinton and Donald Trump will face off in the general election.

Bloomberg offered some advice for the nominees:

"The public wants simple solutions to complex problems," he said, adding that if there were actually simple solutions, these problems wouldn't exist at all. "But they also want to make sure that if you promise them, that you know what you're doing."