Ontology ("the science of 'being'") is a whole branch of philosophy that has varied widely during history and won't fit in a forum comment and I'm in no way an expert, so I won't try to. I'll rather give a few strokes of how I use it myself as derived from epistemology ("what can be known?"); I would say that my view is close to (weak) social constructionism[1] - i.e. even though knowledge can be inferred directly from study of the material world, most of it is mediated by the ways we have learned to think about it.

In short, what matters to me as "real" is what can potentially be experienced and studied to make sense of it. The vast majority of "what's real" comes from a physical world external to us; and thanks to modern science, we know that even the part we perceive as thoughts and emotions comes from material processes in our bodies, without the need to postulate the reality of a supernatural substance as its basis.

However, it is a useful shortcut to consider these mental processes in themselves, without always referring to what physical processes underlie them, but looking at them from our own inner perceptions. So, the 'real' things are the material entities outside our brains, and also the thoughts, feelings and perceptions we hold about those external entities and about our own mental processes. Mathematics would belong to this second mode of being real. (This is different from classic Dualism, which would assert that what I see as 'mind entities' do have an existence outside our own minds, but their essence is different from that of material entities).

In the case of math, the concrete ways we communicate them to our peers and the representations we use are of great relevance. Even though two very different representations of a phenomenon can be claimed to model the same 'underlying mathematical reality', I see no need to assert the reality of a mathematical object existing in the celestial sphere somewhere above the orbit of Uranus, which is how Plato imagined the actual reality of the mathematical objects on which the imperfect real things were based.[2] I'm content to say that such reality is a logical consequence of the axioms we have socially chosen to use as the basis of our mathematical theories (and that, starting from other axioms, the mathematical reality of such objects could be slightly or totally different. I'm currently studying Category theory to see how precise one can be in studying such differences and similarities).

(However, if somewhere found a way to demonstrate empirically that such realm exists and show the way how physical objects are connected to it, I would change my position and would be eager to study whatever can be known from that approach - I just don't expect it to happen anytime soon). For this latest position, see the classic Carl Sagan's The Dragon in My Garage [3]; I find that arguments from Dualism about the existence of mathematical entities often tend to parallel those from religion, as they stem from the same Western tradition of ontology.

I hope all this wall of text makes sense and your curiosity has been satisfied :-) What ontological tradition do you come from, and how do you see this perspective of mine?

[1] https://en.wikipedia.org/wiki/Social_constructionism

[2] https://en.wikipedia.org/wiki/Hyperuranion

[3] https://rationalwiki.org/wiki/The_Dragon_in_My_Garage