Math is just... It works because reality is a function of cause and effect, of selection of subsets from sets on the basis of process or constraint.
Math is just the language that captures this in the most general possible way.
As long as reality is "stuff, amid rules, will lead to different but specific arrangements of stuff", that's math.
Essentially, math works because the universe has observably deterministic elements.
The things math cannot describe are in the bucket of "truly random outcomes". It is unclear whether any thing is truly capable of randomness or merely things so chaotic they cannot be predicted.
To elaborate, "which direction the photon spits off the electron shell" cannot be predicted as far as we know. It is apparently "random". Math cannot speak to what that direction shall be*. At best math can speak that "it will probably happen from this locus".
As such, math apparently cannot describe the future of a quantum event. It is "random".
Math starts where randomness ends, and the more we look, the more we discover that the things we think of as "random" are merely chaotic, but ultimately describable by math.
*Unless the release is a stimulated amplification.