In my opinion, ideally, it is a discovery: one sets certain axioms as a starting point and discovers the tree of theorems which results from them. In reality, a lot of developing is going on, namely shaping and formulating the concepts with which one works. For instance, the concept of connectedness or simple connectedness was developed by mathematicians to express certain properties of sets. The rules which sets have this property and what other properties such sets have, is something that is discovered by formulating conjectures and proving them.
The fool hath said in his heart, There is a God. They are corrupt, they have done abominable works, there is none that doeth good.
Psalm 14, KJV revised edition