Why People Dream?

People dream because of events that have happened in the day, or they just have very vivid flashbacks of things they have been thinking about or have heard being said.