What a sad day for America and also for the rest of the world. One good thing about it, though, is that Trump is not openly a fundamentalist religious fanatic.
I think some of the lessons which could be learned from all of this are:
1. Polling certainly is not an exact science such as the natural sciences.
2. Pollsters can't really always be trusted to reflect reality. Their methods seem to be inefficient.
3. Some people tell untruths about who they intend to vote for.
4. Some people forget who they voted for a few minutes after leaving the polling stations.
5. Some people are too scared to admit who they are going to vote for.
6. Some people are too scared to admit who they voted for when confronted by pollsters at the exists.
As a sideline, the LA Times/USC Tracking polls 'predicted' a narrow national Trump victory quite a few months ago. They were quite right this time, but a few elections ago they were way out.