In Animal Crossing: Wild World, a neighbor who has moved away may eventually come back on their own, though it's largely outside your control.
To keep a resident from leaving in the first place, even after they've started packing, spend a long time talking to them inside their house. With enough attention, they'll decide to stay.