Months of anti-foreigner protests across South Africa have forced tens of thousands to leave the country.