 As you just said, it varies a lot, and it can get really complicated quickly. For team sports like basketball and soccer, coaches decide who competes, and then for individual events, it's more all over the place. Swimming has one of the most objective paths to the games, with many countries just sending their top two swimmers at their Olympic trials. And many nations do a somewhat similar situation for track and field.