In order to get a villager back after they have moved out, you have to cycle through 16 more villagers first. That means 16 new villagers need to move out of your town before you can get the first one back. As you go through this cycle, you will at some point see the villager appear on your Main Street. I've forgotten how many villagers into the cycle you are before they appear on Main Street. When the villager finally disappears from Main Street, that means you've completed the cycle and can invite them back into your town.
There is a way to circumvent the 16 villager cycle, but you can only do it if you own that villager's Amiibo card. By scanning the card and inviting them to move in, you can move the villager back in any time you want. But this only works if you scan the Amiibo card yourself, not if you visit another player who has scanned them in.
Hope this helps!