The two-term Republican had faced criticism from the right for wavering over Trump’s pick of Pete Hegseth to lead the Defense Department. She was first elected to the Senate in 2014.