We are beginning to understand how our brains shape our dreams, and why they contain such an eerie mixture of the familiar and the bizarre