There are lots of ways of doing that. In Australia it's done differently than it is in Ireland, and even within Ireland, when we elect the upper house, the Seanad, it's done in a different way. Essentially, it's seen as a random process in which the votes transferred are a cross-section of all of them with regard to their next preference. They're randomly selected, however, with regard to lower preferences.
That's the real nitty-gritty of PR-STV, which I probably shouldn't even be trying to explain, because it makes it all sound much more difficult than it really is.