Is mathematics discovered or created? This question is a central one in the philosophy of mathematics. Is all of mathematics "out there" in some sense, just waiting for people to discover it, or do people create mathematical knowledge? If you think about it, Fermat's Last Theorem, for example, doesn't seem to exist anywhere in the world. However, if it doesn't have an independent existence, how is it that everyone can agree that it is true?
The ancient Greeks were the first to consider this question. Plato (427–347 B.C.) recognised that mathematics involves ideal objects that don't exist in the real world. For example, a line is perfectly straight, is infinitely long and has zero width, but no matter how well you draw a line in the real world, it will only have a finite length, will have some small width, and won't be perfectly straight (under magnification, you could probably notice imperfections in the pencil mark, for example). The same goes for points, circles, triangles, quadrilaterals, and the like.
Plato concluded that, because the mathematical objects are not to be found in the world, these mathematical objects must exist in what he referred to as the world of Forms (or Ideas). The world of Forms is in a sense more real than the world that we live in; the lines and points and circles that we see in our world are in a sense just shadows of the ideal lines and points and circles in the world of Forms. This view may be called Platonism (this is a modern concept of Platonism, not to be confused with what was referred to as "Platonism" in antiquity).
While some of Plato's philosophical views are no longer widely held, his attribution of objective reality to mathematical objects has been a significant view of mathematics for the past 2,400 years. Other widely-held views exist, however. There are three that were developed in the first part of the twentieth century that are worth noting.
Logicism is the view that mathematics is reducible to logic. Under this viewpoint, mathematical statements are viewed as "analytic", or true by definition. To take a non-mathematical example of an analytic statement, if you wanted to verify whether the statement "All bachelors are unmarried" is true or not, you wouldn't go and take a survey of bachelors to see whether they were married or not. You would just go to the dictionary and look up the word "bachelor," and see that it means "unmarried male". The fact that a bachelor is unmarried is true by definition; knowing this fact doesn't provide any knowledge of the external world, just the English language. As another example, the statement "All unicorns have horns" is true by definition, but it doesn't tell us anything about the real world (in which there are no unicorns). Similarly, "1 + 1 = 2" would be necessarily true based on the conventional definition of "1", "+", "=" and "2", but this doesn't provide any information about the external world. For me personally, this view holds some appeal. If you think about it, we gain knowledge about mathematics in a different manner from the sciences; mathematics makes extensive use of proofs that use deductive reasoning. However, you can't create new information using deductive reasoning; the conclusions are, in a sense, already implicit in the definitions and axioms of the system.
Bertrand Russell (1872–1970) championed logicism. The enormous work Principia Mathematica by Russell and Alfred North Whitehead is their attempt to reduce mathematics to logic. Incidentally, it is not until page 379 of the first volume that it is shown that 1 + 1 = 2. The view of logicism was shaken somewhat in the 1930s by Gödel's Incompleteness Theorem (Gödel, incidentally, was a Platonist), but, since this theorem, like all other theorems, is proved using logic, it is not a fatal blow to logicism.
Formalism is another viewpoint, this one championed by the German mathematician David Hilbert (1862–1943). According to this view, mathematics is nothing more than the rule-based manipulation of symbols that have no inherent meaning. We may give a meaning to these symbols; however, when we do, we are outside of mathematics and in metamathematics. We may choose to use some sets of rules and not others because certain choices of rules create a metamathematics that can be applied to the real world or has other useful qualities, but there is nothing inherently special about these choices from a mathematical perspective.
The third twentieth-century view of note is intuitionism, developed by the Dutch mathematician L. E. J. Brouwer (1881–1966), which viewed mathematical statements as being a creation of the human mind, constructed through our subjective intuitions. We can all agree on mathematical truths simply because we are all humans and our brains are wired in a similar fashion.
There is no common agreement among mathematicians and philosophers as to which view is "correct." As this is a philosophical question and not a mathematical one, one view or another can't be proven to be correct mathematically. They all have their supporters and critics. There are good points to be made for all these views, as well as potentially serious objections.
Sources used (see bibliography page for titles corresponding to numbers): 25.