In the first round, it should go to the player with the lowest initial ranking. After that, it depends, but it would ordinarily go to a low ranked player in the lowest score group.
According to rule A.2:
For pairings purposes only, the players are ranked in order of, respectively
(a) score
(b) pairing numbers assigned to the players accordingly to the initial ranking list and subsequent modifications depending on possible late entries or rating adjustments
Rule B.2 says:
To make the pairing, each bracket will be usually divided into two subgroups, called S1 and S2.
S1 initially contains the highest N1 players (sorted according to A.2), where N1 is either M1 (in a heterogeneous bracket) or MaxPairs (otherwise).
S2 initially contains all the remaining resident players.
And rule B.3 says:
S1 players are tentatively paired with S2 players, the first one from S1 with the first one from S2, the second one from S1 with the second one from S2 and so on.
There is ordinarily no reason to change the tentative pairings in the first round, and everyone's score is 0. If there are an odd number of players, then S2 will contain one more player than S1. When you pair S1 with S2 as the rule says, there will be one player left over, and this player receives the bye. So, the bye in the first round would ordinarily go to the last player in S2, which in this case is simply the player with the lowest initial ranking.
In later rounds, however, those tentative pairings could change. As you noted, the bye cannot go to the same player twice. Other pairing rules also come into play; for example, if switching who gets the bye will improve the number of players who get the color they are due, then it will be switched. You may have to pair everyone before you can confidently determine who gets the bye in later rounds.
The bye would ordinarily go to someone in the lowest score group - however, it is also possible that score groups will collapse into each other in certain circumstances (see rule A.9), and this could result in someone with a higher score getting the bye instead of someone with a lower score, even if neither has yet received a bye.