As a mathematician, I have thought about this issue quite a bit.
The first issue is defining mathematics. To include modern math, I define it as the study of abstract formal systems.
So, the second issue: Equations like the Pythagorus identity (that a^2 +b^2 =c^2 for a right triangle) are NOT true without some assumptions. In particular, this equation requires the assumptions of Euclidean geometry. But we *know* that there are other geometries that are equally consistent to Euclid's. In such geometries, this relation is false. So, there is no 'a priori' reason to think the Pythagorus identity is 'true': it is false in other systems that are just as 'valid' a priori as Euclidean geometry.
Next, we can say similar things for many other 'clearly true' statements. For example, the statement that 5 is prime depends on the number system used. If we use the Gaussian integers, it is no longer the case that 5 is prime (it can be factored as (2+i)(2-i) ).
Another piece of the puzzle: Godel showed that any system of axioms that is strong enough to talk about the positive integers *cannot* be proven internally to be consistent. In addition, such systems will *always* have statements that can neither be proved nor disproved in that system (such statements are said to be independent). For an independent statement, we can literally choose whether it is true or false and neither way will produce new contradictions.
So, as a thought experiment: is the game of chess independent of our minds? We certainly invented it. But, once we have chosen the rules, are the winning strategies, the solutions of various problems, etc determined? Or are they just part of our mental world with no 'outside' component?
Now, in the way I think about it, we invent chess. But once we have decided on the rules, we discover the consequences of those rules. The game of chess still only exists in our minds, but there is a component that is now to be discovered.
As I see it, the exact same thing is true of mathematics: we invent the rules and discover the consequences of those rules. Furthermore, unlike with chess, we choose the rules of mathematics to be maximally expressive of abstract relations.
What that means is that once we have chosen the rules we want (those of set theory, for example), we discover the consequences of those rules. Math still only exists in our mental worlds, but because we chose the rules to align with our intuitions *and* to be as expressive as possible, we can use math as a language to describe the world around us.
As to why math is as good as it is in describing the world, I see this as partly by our design of the math. We *chose* the basic rules to allow us to model the world. Much of math was specifically invented to help us describe aspects of the world. So is it really so surprising that a language invented to describe certain aspects of the world actually manages to do so?
And this ignores the wide areas of math that have *nothing* to do with describing anything about the 'real world'. While the funding tends to go for those topics relevant to the outside world, there are very large areas of math where no expectation of applicability is held and where the internal beauty of the ideas is paramount. Such areas are NOT descriptive of the 'real world' and are not meant to be. They are more like 'science fiction' if you want.
As you can see, I am not a Platonist. I am very much a formalist when it comes to math. BTW, there are other views on how math works: look up intuitionism and intuitiionist logic at some point.