The Speaker of the US House of Representatives is chosen by a majority of the members of the House.
If one party makes up a majority of the House, and is unified with who they want to lead it, that means a simple vote where that one party provides a majority of the votes of the House, and nobody else can win because any other candidate would have to be in a minority.
If no one party is able to do that (eg because there are more than two parties represented and no single party has a majority, or because a party which nominally holds a majority is fractured about who they want to see in charge), then they need to keep voting until the House at large can find a candidate supported by the majority of the House. This could involve a compromise where members of multiple different parties vote together for a candidate they can both live with.
Ultimately, if they cannot find anyone capable of commanding majority support, they could change the rules to allow a Speaker to be chosen by plurality (where the person with the most votes gets to win, even if they don’t have a majority of all the votes).
Latest Answers