The top two (old server is all I know) from each realm based on the realm rank go to HP. Setting up is done like before, but it must be done by people within the realm. So if the 1st and 2nd on a realm can not see each other they will need help from the other realms to move up or down so that they can.

It is nor clear to me if being attacked by some one from another realm after set up messes up the set up. We have not experience with that, except an accidental attack 20 minutes before server reset that did not change the set up, but that could be because the formations were already frozen.

As far as how the Realm rank for the players that are in UA is determined, I have no idea. The logical thing would be based on the rank in UA but that is not always true. I have seen the player that was the 2nd highest on my realm based on the UA have a Realm rank of 4, with 2 and 3 being lower in UA that he was. It may have something to do with who he did battle with to move up or down within UA and if he skipped over some people of his own real in doing it, but that is just a guess.