Question about "should" in an "if/then" construction

I recently found myself wondering why there was a difference between:
If it runs...
and
Should it run...
After a lot of thinking and some research, my hypothesis is that this usage of the word "should" came into use after the "if/then" construction and when it was shoehorned in, it brought its modal grammar rules with it (with the main verb taking the infinitive). I could also be completely wrong. Any ideas?
Welcome!
My idea:
1. Shall is used to state a fact about future.
2. We put one step back in time to make the present—–> should ——–> If you should….. (=If this fact happens)—–(inversion)——> should you... .
Waiting for Bob's and others' ideas!

I was going to just say "I agree with Rafee" and leave it at that. But I couldn't quite leave it alone; I kept running over, in my mind, different ways to say the same thing: "Should it run…", "if it run…" (that would be subjunctive), "if it shall run…" and so forth. And finally I had A New Thought: I'll bet that in the sentence "if it should run", "should" is the subjunctive form of "shall".
It occurred to me only this minute, so I haven't had time to examine it and see whether it's wrong. What do some of the rest of you think? It fits the usage: "If it shall run" is indicative, and after "if" the older Anglophones would want the subjunctive instead (though we don't use the subjunctive with "if" much any more).

Bob Bridges provided full information on the topic. I can just emphasize that "Should it run....." is an inverted form, done for emphasis, perhaps for achieving different stylistic effects in fiction and prose .

And should we fail, your smiles will break our fall
In contexts like this old verse, 'should' might well have no connections to 'shall' at all, because for all intents and purposes it is the exact equivalence of 'if.' And this usage is always common in both old and modern English.