Mathematics works only to the extent that it is logical.
There is in this respect nothing specific to mathematics as compared to our other modes of representation. They will all work as long as our modelling remains logical. Language works. Diagrams work. Pre-linguistic thought works. Any model works, as long as it is kept logical.
Thus, the value of mathematics is entirely in the fact that it is a more formal, and therefore more rigorous, mode of representation than our other modes of logical thinking.
All is said in Wikipedia's article on Mathematics:
Through the use of abstraction and logic, mathematics developed from counting, calculation, measurement, and the systematic study of the shapes and motions of physical objects. Practical mathematics has been a human activity from as far back as written records exist. The research required to solve mathematical problems can take years or even centuries of sustained inquiry.
Rigorous arguments first appeared in Greek mathematics, most notably in Euclid's Elements. Since the pioneering work of Giuseppe Peano (1858–1932), David Hilbert (1862–1943), and others on axiomatic systems in the late 19th century, it has become customary to view mathematical research as establishing truth by rigorous deduction from appropriately chosen axioms and definitions.
Mathematics works because, and only to the extent that, it is logical.
We got our logic through natural selection so, presumably, it was thoroughly tested over something like the 525 million years of the evolution of neuronal systems over the entire biosphere.
This doesn't mean that it should therefore work in all situations, only that it could be difficult for us to find one where it doesn't work.
Mathematicians can also invent theories that don't "work" because it just happens that there is nothing in the universe that works like that.
When a mathematical theory works, it can be thought of as a model of something real. For any such mathematical model, there is no good reason to claim that we know that it will work for ever, as if it was somehow a perfect model. In effect, we may believe that it will work for ever when in fact it won't because at some point in the future the model will be falsified by new facts. And we don't know the future.
In this case, we just don't know when it will stop to work. So, we can only believe that mathematical models will work. And then, that a model works doesn't mean that it is correct. Newton's laws of gravitation worked beautifully but then were effectively falsified by the more precise observation of Mercury's orbit.
Thus, we don't really know whether mathematics works since we don't know if it works for things we haven't been able to observe yet.
It may well be that we won't find anything ever for which mathematics doesn't work. However, this should be no surprise. I don't know of anything in nature that would somehow be illogical. So, again, as long as mathematics is logical, we should be safe.
So, again, this isn't specific to mathematics. Any model, as long as it is logical, will work. The specificity of Mathematics is that it is a more formal and therefore a more rigorous mode of thinking.
Pre-linguistic thought also works as long as it is logical. For example, you can try to think of Russian dolls. No mathematics. No language. Just your mind's power of imagination. Think of three dolls: doll A, doll B, doll C. Try to imagine a situation where doll A would be inside doll B and doll B inside doll C, while doll A wouldn't be inside doll C. Me, I can't. Our mind seems a pretty good model of reality and this before any mathematics at all.
So, the question of why mathematics works is trivial. It works because human logic works, and mathematics works only to the extent that it is logical.
The reason that logic works is less trivial. It works because it has been thoroughly tested by nature itself and finding a flaw in it is probably not easy at all. It seems safe to believe that finding a flaw in logic is beyond our current technological powers and will remain so for a very long time.
However, here too, there is no eternal guaranty. Only the future will tell.
I don't think I need to dwell on the question of the role played by abstraction in mathematics.