Here is the ranking scenario in more detail.
As pointed out above, only Serena, Kerber or Aga can come out as #1 after USO.
1. In order to possibly remain #1, Serena must reach at least SF independent of what other players do.
2. If Kerber reaches quarterfinals, Serena will lose #1 if Serena does not reach the finals.
3. If Kerber loses in the quarterfinals or semifinals, Serena can retain #1 just by reaching the finals.
4. If Kerber wins the semifinals, Serena needs to reach the finals and win the final against Kerbie to retain #1.
5. In order for Aga to come out as #1 she needs to win USO outright and even then Aga would not be #1 if Kerber reaches the finals (in this case Kerbie will be #1 and Aga #2).
The above covers all possible situations.