Who came up with the idea of number systems and for what reasons?The origins of numbers date back to the Egyptians and Babylonians, who had a complete system for arithmetic on the whole numbers (1,2,3,4,...) and the positive rational numbers.
The Greeks at the time of Pythagoras knew that these number systems (whole numbers and ratios of whole numbers) could not completely describe everything they wanted numbers to describe. They discovered that no rational number could describe the length of the diagonal of a square whose sides were of length 1. They called such lengths "irrational", recognizing that some other kind of number system would be needed in order to describe them, but not knowing what it would be. They did not pursue the matter, for they viewed whole numbers with such awe that anything not expressible in terms of whole numbers was distrusted by them as contrary to nature.
These number systems evolved somewhat during the Middle ages with the notable addition by the Hindus of a convenient notation for zero and negative numbers, concepts which previously had been difficult to deal with due to the lack of notation. The properties of the "real number system" (consisting of both rational and irrational numbers) began to be understood in the 1600's with the development of calculus, and by the end of the 1800's mathematicians such as Dedekind and Cantor were giving rigorous mathematical definitions of this number system, putting it on equal footing with the whole numbers and rational numbers.
It wasn't until the early 1800's, however, that the abstract structure of these number systems was studied. This new area of math, like many other areas of math, arose from a creative new way to answer an old question: how to find the roots of a polynomial (those numbers which, when substituted into it, give zero).
Much was known about polynomials of degree (highest power) less than 5. Italian mathematicians had solved for the roots of the 3rd and 4th degree polynomials in the 1500's. These solutions were always expressible in terms of "radicals" or nth roots of numbers. For a long time no one knew how to solve a general 5th degree polynomial for its root.
Polynomials of lower degrees were still of interest though. In search of a deeper understanding of them, Gauss studied quadratic (2nd degree) polynomials. Through his work, he found that the objects he was considering were related to each other in much the same way that numbers are related under addition or multiplication. In modern terms, he was considering "finite group structures": finite sets which are essentially like a number system, but with only one operation. In many of the groups which he worked with the order in which the operation was performed doesn't matter: a ·b = b ·a. Groups in which the operation commutes in this way are called abelian groups. It is believed that Gauss may have been one of the first to have a rough understanding of the structure of finite abelian groups.
Also related to the study of polynomials is the "theory of substitutions" studied by Lagrange, Vandermonde, and Gauss. A substitution is where the variable of the polynomial is replaced with a different expression (such as a new variable plus a constant). It is possible sometimes to make the "right" substitution and turn a very complicated polynomial into something much easier to handle. This led to the study of the permutations of a set. Also studied by Ruffini and Cauchy, the permutations of a set form a group structure as well, though in this case the order of operation matters and therefore the groups are non-abelian.
Any discussion of the study of polynomials and number systems incomplete without a mention of Galois. He was the first to fully understand the connections between these finite number systems and the behavior of the roots of polynomials. It follows from his work that there is no "nice" formula for the roots of some 5th degree polynomials. While he died in his early 20s in a duel, his work (which was allegedly written in a letter and sent to a friend the day before he died) is still one of the cornerstones of the study of number systems.