In January 1997, after a rocky first term as Speaker, Newt Gingrich (R-GA) was re-elected as Speaker.
His popularlity was waning and several Republicans either voted or present or for another Republican.
By the summer of 1997, Gingrich barely survived an engineered coup attempt by GOP rivals.
Republicans held the House in the 1998 midterms. But by the most-narrow of margins. Many Republicans had grown tired of Gingrich and thought he overplayed his hand on the impeachment of President Clinton.
Still, Gingrich stepped aside as speaker later that November.
In other words....
Republicans held the majority in 1998 and would have kicked Gingrich out if he stayed.
In this instance, Republican shellack the Democrats...and Pelosi tries to stay.