Anyway, I'm interested in how the human mind can deduce patterns where in fact no true pattern exists and how this relates to religiosity, if it does.
The "why" of the first question is easy - pattern recognition is a useful trait and occasionally seeing patterns where there are none is more beneficial than not seeing patterns where some are.
The "how" is a tough nut, what with the monstrous complexity of the brain, not even going into the unanswered questions about the nature of consciousness.
As for the second question, it surely does factor into religion as it does, in fact, factor into every worldview. How could it not?
The real crux is not that random patterns are sometimes falsely recognized as non-random paterns, imo - that's just an imperfection of our perception, very much like seeing two lines of different lengths in an optical illusion featuring two lines of equal length.
The bigger factor by far is the attribution of agency to patterns perceived - correctly or otherwise. This is of course again easily explained as a beneficial trait. A threat is a threat no matter if it's a flashfire or a wolf pack and the distinction is irrelevant if the goal is simple survival and nothing more.
But of course the combination of the two does have some ramifications that are perhaps more important in the formation and maintaining of religiousity than they are elsewhere. Where there is (pre)supposed agency and explanations are sought, those explanations will entail agency - and thus, motives.
Unidentified false patterns need explaining in much the same way. Add the usual heuristic biases to pattern recognition and it's easy to see how patently nonexistant phenomena suddenly demand explanation - explanations that, once the biases as well as agency are removed, seem patently absurd in retrospect.