“How does that happen when West just lost his election?”
It happens because there is absolutely no rule that the speaker of the house be a member of the house. They could elect Kim Kardashian if they wanted to.
She could do as good a job.
Maybe better.