How were the polls so wrong?

Tuesday's election was a shock to many, but possibly because of faulty measuring.