Remain should have put far more effort into breaking the Leave constructed link between immigration and poorer public services. They massively underestimated how easy the sell would be that UK problems are the fault of others. It's something too many people are too keen to embrace. The Leave campaign didn't choose to run a xenophobic campaign because it doesn't resonate with their target audience. Cameron and others completely underestimated the numbers that would be happy to be told that if we got rid of freedom of movement, everything would be better. You can see how much Johnson has learned from that, his casual racism has become much more emboldened and he has recognised how enthusiasitic previous immigrants are to have fewer joining them.
...
Since Cameron headed up the Remain campaign, we would have to ask him why he didn't counter the obvious arguments.
It's not like he wasn't warned. In the previous GE, UKIP pulled something like 4m votes...and they weren't exactly from the leafy shires or Islington. Their votes came from regions which subsequently voted Brexit.
I can't see any reason beyond ultra complacency. Probably emboldened by his success on Scottish independence.
Regions outside London with >10% ethnic minority population also showed strongly in the Brexit Leave results. Simple racism doesn't explain this. Maybe it's protectionism at play, or fear of change.