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.
We as humans are evolved from a long line of organisms that were (for a long time) not the top of the food chain. This means that as most other species, our primal driving emotion was fear. Fear of death. Our body is prepped to try and survive in any case of fear. 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 Hotwired in the complex structure of neurons. Our brain is behaving primarily to respond to threats. As 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. However, the structures in which the brain is wired is inherited to extend. The decisions are caused by impulses coming in initially. As 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).