But from medical testing to artificial intelligence, one mathematical rule guides much of the modern world — Bayes' theorem.