A villager ends up in your void if they move out without having been adopted. If you let someone who wants that villager to talk to them while they're in boxes (on the last day before they move out), that person has the option to invite them to their town. When you do that, a villager doesn't get voided. They're voided if they just move out without a destination.
When a villager is voided, the game stores the data of the last 16 villagers to have been voided. When you connect to someone through wifi or StreetPass, they can get a voided villager from you. People used to say that you could clear your void by visiting someone with a full town (so that the voided villager would try to move in and fail), but recently, people have been starting to say that's not true. I haven't tested either myself, so just to be on the safe side, if you've voided any villagers, it's nice to let others know in advance.
I think that out of those 16, whichever moves into another town is randomly chosen. If you only have villagers in your void that someone in another town has or had recently, they won't move there.
You can keep voided villagers from moving in by plot resetting and time travelling to invite a villager who can overwrite the random move-in before they plot. I don't know if that clears the voided villager from the other player's void forever or not. You can also ask people beforehand (so that you'll know if you should take extra precautions to avoid getting unwanted villagers) and switch off StreetPass.