[From Wikipedia] Déjà vu is the experience of feeling sure that one has already witnessed or experienced a current situation, even though the exact circumstances of the previous encounter are uncertain and were perhaps imagined.
We’ve all experienced the above before, but why does it occur?
During a daydream, it’s likely you run scenarios in your head about the future. You think what the upcoming weekend will be like, or how dreadful the presentation you are giving tomorrow will be. You can run these scenarios because your brain already knows a lot about the future. If you’re going to be in a room you’ve been in before, you have a setting. If you know who you’ll be with, you have your characters. After you factor in the previous interactions you’ve had with the characters and setting, you can put together a fairly accurate representation of what the future holds.
Similarly, when you dream your brain probably continues this process. Dozens and dozens of times, your imagination takes creative license with the vast amounts of memories you posses to run scenarios about the future.
If something coincidentally happens in the present that feels similar to something that has happened before, it’s probably nothing more than a loose parallel to a scenario from your dreams. I say loose because from my experience, our memories are pretty shotty. Memories seem so clear, but often when you re-experience something you take note at how poor your memory’s interpretation was.
Déjà vu then, in my opinion, is nothing more than a flashback to a dream that was close enough to something you just experienced.