WASHINGTON—H.R. McMaster, pushed out in April as President Donald Trump’s national security adviser, is joining Stanford University’s Hoover Institution, where he hopes to develop bipartisan national security ideas.

Mr. McMaster, who struggled to retain influence in the fractious White House, said, as a senior fellow, he hopes his work can influence national security policy as the U.S. works to combat rising threats from rivals such as Russia and China.

“Our...