Question: how does the speaker of the house lose their job?
Answer: Selection. The House elects its speaker at the beginning of a new Congress (i.e. biennially, after a general election) or when a speaker dies, resigns or is removed from the position intra-term. Since 1839, the House has elected speakers by roll call vote.