Everybody knows that our daytoday reality is in three dimensions mostly, or maybe in 4dimensional spacetime if we like to go really fast. This writeup isn't about physics, although the maths in it appear in countless variations throughout any mathematical description of reality, aka physical theory.
This writeup is about some of the mathematical attempts to capture the essence of dimension.

It's surprisingly long, because (as noted above) dimensions are so simple! Unfortunately, talking precisely about dimensions quickly leads to surprising obstacles  and to results when trying to overcome them. This is my apology for length. Discussion of fractional dimension and infinite dimensions belongs elsewhere  but see also Hausdorff dimension, not just fractional dimension, for the first.

It's inexcusably short, because there's just too much material for me to know, let alone put into a single writeup. I shall therefore try to hyperlink to additional material wherever possible, and only comment dimly on what seem (to me) to be the important aspects. There is no acceptable apology for this brevity, though, except for my ignorance of so much more.
The principal problem with any definition for dimension is ensuring that it is, indeed, well defined. As we shall see below, many toonaïve possible definitions fail. Fortunately, better definitions (in the sense of satisfying many of our intuitivelyobvious properties of "dimension") can be found. Even better is that these definitions lead to volumes of profound mathematics, in all fields.
A note:
Important notions are linked in bold  handy if you (like me) don't want to read the whole thing, just see the brief list of ideas.
Every vector space V over a field F has a basis. We will first consider the case when a finite basis exists. Then it is reasonably easy to show that a basis must, in fact, exist, and that any two bases for the same vector space will have the same number of elements. So it makes sense to talk of V as being (isomorphic to) F^{d}, for some finite d≥0. And we call d the dimension of V. That d does not depend on the choice of basis (because any basis of V will have d elements) makes this welldefined.
This definition makes sense. It turns out that a straight line  R over R  is 1dimensional, that the plane  R^{2} over R, or maybe C over R  is 2dimensional, and that in general we appear to live in (at least!) a 3dimensional reality (or 4, depending on our preferences in physical theories).
We also note some unpleasantries. For instance, we may take
V = Q+√2⋅Q = {a+√2⋅b  a,b∈Q}
as a vector space over the
rationals Q. Then V has dimension 2 over Q. On the other hand, if we look at V inside R, then V has a metric, V behaves in a very compatible fashion with that metric, and it is very clearly onedimensional within that metric. We need to skip ahead a bit, and just note that V shares with R the unique property that if a,b,c∈V, then either d(a,c)=d(a,b)+d(b,c), or d(b,c)=d(b,a)+d(a,c), or d(c,a)=d(c,b)+d(b,a).
Fortunately, such abnormalities do not exist if the underlying field F, equipped with a compatible topology, is complete; as distance is anyway only wellbehaved in situations of analysis (rather than number theory, where nothing works anyway), we gloss over it: Mixing algebra and analysis requires a bit more effort than just taking an unrelated notion from each and hoping they get along.
For the balance of the writeup, I will consider almost always just the case F=R, so F is a complete field, and we can ignore these abnormalities  we shall have plenty of others.
Functions
Trouble immediately strikes when we consider functions R^{m}→R^{n}. "Obviously", we want functions not to increase dimension. For instance, in a physical system the dimension often corresponds to a degree of freedom, and it is pretty meaningless to have a procedure for increasing degrees of freedom!
Unfortunately, we have the easy
Theorem. For any dimensions m and n, there exists a mapping f:R^{m}→R^{n} which is onto. Moreover, f is onetoone.
The case m<n quickly dashes our hope of injecting any physical reality or sense into the situation. All finite vector spaces R
^{d} have the same
cardinality.
Let's try to limit f, then! Surely a continuous function would be better behaved! (After all, the function f employed in the above theorem is highly discontinuous, and completely ignores the intricate structure of the vector spaces, treating them merely as sets of objects.)
The Peano curve is a continuous spacefilling curve. It maps [0,1]→[0,1]^{2}. A continuous function can map one dimension onto two. Once again, all seems lost.
Thankfully, Brouwer's invariance of dimension theorem says that things are not quite that bad. It states that R^{m} and R^{n} are not homeomorphic for any m≠n. For instance, R^{2} is not homeomorphic to R^{3}, because if we remove one point from R^{2} it is no longer simply connected, while R^{3} remains so even after removing a point.  cjeris supplied the material for this section, including a fascinating history which I snipped; thanks!
It would be nice to have a stronger argument, though, that "nice" functions cannot increase dimensions (in the same way, say, that measurable functions cannot increase entropy). And fortunately, we can in fact do better. As soon as we demand that the mapping be continuously differentiable (C^{1}), Sard's theorem (or rather, one of the many variants of that name) can be used to show that it cannot increase dimension. Anything like Peano's curve cannot have a derivative; this is true of any mapping from m dimensions to n dimensions, when m<n.
Manifolds
At last we have a mechanism (dimension defined as the number of elements in a basis) and justification for using it (it behaves correctly with suitably limited functions  those that appear in physics). Immediately we can move to working on (suitably smooth) manifolds  spaces which locally appear like R^{d}. Our definition of dimension localises easily: we just want to have a basis of d elements in every neighbourhood.
Manifolds are very nice mathematical objects. As expected, their topology is very much determined by their dimension. One important ongoing subject in differential topology is the classification of manifolds. For instance, in 1 dimension we have 2 manifolds: R and S^{1} (the circle); one of these is compact. In 2 dimensions we have infinitely many types, even just for compact manifolds. But all can be constructed using just a few "primitive" manifolds (tori and projective planes); see using Asteroids to explain the topological classification of 2manifolds for details presented in a highly amusing way. Higher dimensions get rapidly more complicated; Ed Witten received a Fields medal for work on classification of lowdimensional manifolds, but many questions (e.g. the Poincare hypothesis) remain open.
Scope of discussion
Lowdimensional manifolds are highly intriguing. There is some fairly obvious physical importance (particularly in dimensions 3 and 4), and these are (coincidentally or not!) the dimensions when the really interesting things start happening!
Obviously, geometry is affected:
 In R^{2}, the 4color theorem holds, and for compact 2dimensional manifolds it appears that some kcolor theorem will hold. But as soon as we go to R^{3} and higher, a trivial construction cannot be coloured with finitely many colours: two sets of aligned rods, touching at right angles to each other  e.g. a woven carpet, infinitely large  cannot be kcoloured for any finite k.
 Complex analysis has its contour integrals, which can be used e.g. to define the winding number of a curve about a point. Analogues exist in higher dimensions, but not everything generalizes to them.
Two examples from
probability theory, just to show how far these things spread:
 A simple random walk in two dimensions is recurrent: it (almost surely) returns infinitely often to the origin. (And Brownian motion in R^{2} is also recurrent: it (almost surely) returns infinitely often to any neighbourhood of the origin; this in turn connects to several topics in analysis...).
 The most important questions in percolation remain open in dimensions 3, 4 and 5. Techniques invented for dimensions d≥6 are known not to work in these dimensions. However, no surprises are expected regarding the actual behaviour  just a wholly new method of proof.
A line has no part which looks like a circle; obviously, if M and N are manifolds of equal dimension d, it need not be possible to find a copy of M inside N. If M does have a copy inside some manifold K, then by Sard's theorem dim(M)≤dim(K). What dimension do we need to guarantee we can find a copy of M inside K?
A fairly simple proof shows
Theorem. For any manifold M of dimensions d, there exists a smooth function f:M→R^{2d+1} which is onetoone.
The proof relies first on embedding M in a much greater dimension R
^{k}, and then using Sard's theorem to show that
almost always a random
projection R
^{k}→R
^{2d+1} will yield a onetoone smooth mapping.
More work shows the tight bound:
Theorem. Any manifold of dimension d can be embedded inside R^{2d}.
So e.g. the Klein bottle (which is 2dimensional) can be embedded inside R^{4}; it cannot be embedded inside R^{3}, because it is nonorientable.
Abstracting away
Algebraists like to do away with everything concrete. We can analyse manifolds with techniques such as homotopy theory and homology (mostly cohomology). While abstract, these give us reallife results such as the Euler characteristic (VE+F=2 in R^{3}, and a corresponding result for the appropriate alternating sum in every dimension).
Such characteristics can be totally combinatorial (note, however, that they have many deeply geometric related consequences). In particular, it is possible to define and study simplicial complexes, which abstract away almost all the geometric properties which we supposed we were studying, and yet still give meaningful results. The most important parameter of a simplicial complex is its dimension  despite being nothing more than elaborate hypergraphs.
Abstracting yet further, combinatoricists go into graphs, hypergraphs, matroids and the like  finding it useful to discuss "dimension" and related concepts. These can be seen either as naming by analogy, or as stripping away almost all of the theory of manifolds in order to find more universal results.