The small-town South Dakotan rose to the Senate’s top post by deftly navigating spending fights and the ascent of MAGA.