Just to clarify, the counting of votes in the UK is the responsibility of the local government (the city or county, in US terms).
There’ll be no exit poll in this case, since exit polls work by comparing results with the results of the previous vote, and the last EU referendum in the UK was too long ago to be of any use for this purpose.
How long it takes to count the votes in each local government area depends on a number of factors. How many people have voted? (All other things being equal, a high turnout obviously makes for a longer count.) How many people has the local government provided to conduct the count? Is the area small and compact, or large and sparse? (Votes are brought to a central location for counting.)
The counts from each area are declared locally, and are aggregated to determine the final outcome.
Results from small local government areas with low populations tend to come in first, from about 2 hours after polls close - say, around midnight - but they tend to be too small and idiosyncratic to be much use for making projections.
Within the hour after that, you will start to get results from larger areas that, traditionally, make an effort to be among the first to declare - Sunderland, in the North East; Swindon, to the west of London; a couple of others. The actual outcome in these areas won’t determine the outcome nationally, of course, but any variance between actual outcome and what the opinion polls for these areas were saying before in recent days and weeks can be used to attempt a projection of the national outcome. Swindon, for example, is expected to vote heavily for “leave”; if it doesn’t, that might signal that the “leave” campaign is in for a torrid night, even if they actually win Swindon.
Another hour, and you’re getting results from smaller areas in Northern Ireland and Scotland. Again, these won’t be nationally representative in themselves (they are confidently expected to vote “Remain”) but they may help to clarify how accurate polling has been.
Another hour, and results from London districts are coming in. We’re up to 3:00 am now. At this stage we have a sufficient diversity of results from different parts of the country to get a very good handle on how well the polls are being borne out, and it becomes possible to make increasingly strong predictions about the areas yet to declare. But that prediction could well be “it’s going to be very tight”.
If it’s really tight, you may well have to wait until around 7:00 am on Friday for all the results to be declared from every area. Even then, there’s a possibility of recounts if there are challenges to the integrity of the counting process (but that would be for particular areas, not nationally). But, barring recounts, the result should be officially declared at breakfast time on Friday morning.