Deja vu (as far as I have been able to investigate and incorporate existing research) is the moment the mind recognizes a pattern that has been (at some prior time) ‘considered’. This means that the brain has a response structure for it and at the moment of deja vu, it fills in the blanks. That is why the consciousness feels everything that transpires is predicted. But this only goes for the very basic response to stimulus.
Humans are the result of evolution over a long line of organisms that were (for a long time) not the top of the food chain. Our brains is the evolved version of the brain of other primates. However, our line has had the luxury to gain so much overhead in responses, that we could counter possible threats, before they occurred. This means that our system has space and basal response blueprints (instincts) embedded that are not used anymore. These options made us, as species become self aware. The same options caused us to become ‘religious’ (seeking a parent outside, or generally called animism), plan extensive, become verbal in more complex ways and sometimes have been hotwired in the complex structure of neurons.
Our brain is behaving primarily to respond to threats. We don’t have those in all levels of society anymore. There are levels where most of these parts of the brain are used for more cognitive options. The structures in which the brain is wired is inherited to extend. The decisions are caused by impulses coming in initially. When we come to a moment of deja vu, some arbitrary part of such a decision tree, is activated and the brain shoots hormones and other neurotoxins into the bloodstream to activate defenses of the organism. Such gives the organism a hastened response (heightened awareness) and the moment the brain sees something. The organism has the idea it has already transpired. We as humans are aware of direction of time and know that we can’t act what has already transpired, so our consciousness tries to make the event fit and you get the ‘idea’ that it was a repetition of an earlier event (but as we KNOW we haven’t been in that specific situation, we tell ourselves it must have been a dream).