I think it's hard for outsiders to really know what happen. But for me, it's seem like to the Remain, it's about economic problem, while for the Leave, it's pretty much about the immigration problem.
The EU in general is pretty much just wasted potential, so the fact that the UK is leaving won't make a huge difference. The EU would work well if it followed the federalist structure of the United States, but each EU member state is unwilling to give up power, so the EU isn't able to do much anyway.
Too soon to tell what could happen in the future but this is obviously not a good start and it's not really a comfortable position to have to rely on assumptions and possibilities