Doesn't the mind take subconscious 'notes' throughout the day and try and put them altogether which is why dreams are often so wierd and varied?
I remember before having a dream about a yellow Ferrari being driven by someone I knew. I realised when I woke up that I had VERY briefly seen a yellow Ferrari earlier the day before and overheard someone mention the friend driving in a conversation I wasn't involved in. It's like my brain picked out points to remember that I didn't take note of myself.