Insomnia is awful, but scientists have revealed the amazing reason why you have it