Answer:
On the basis of seniority.
It depends on the committee. If it's a powerful committee, or has prestige to it, then it will go to either the most powerful, the most clever, or who was owed a favor.
If it's a working committee, or small time, or lacking in prestige, then it will be given to either the least favorite member, or the one with the least seniority, or as a mean joke to someone who doesn't realize that it's just a bunch of work, not an honor.
By way of example, picture who will likely Chair the House Ways and Means Committee, versus who will likely Chair the Church Bake Sale Committee.
From the majority by the party caucus.