It most likely happens when dendrites misfire and loop around a memory string. Normally ones mind gets on the right thought train but sometimes that train glitches and another train comes to deliver the same message.
:o How so you know that your mind isn't still playing tricks on you? Wake up! Wake up! ... 0_o
Woah, deja vu!