As Noung has said the inverse function is one that "reverses" the effect of a function. More precisely, if g is a function from X to Y, its inverse is the function g^{1} such that ∀ x∈X,y∈Y g(g^{1}(y))=y and g^{1}(g(x))=x.
Existence
An obvious question is when does an inverse function exist? Lets say we have a function g that goes from a set X to a set Y, so if we take x ∈ X then g gives us y ∈ Y.
Now we try and go backwards: we take y ∈ Y, and try to find x ∈ X . We are going to need two conditions on g.
 Different values of x must give different values of g(x). If g(a)=g(b)=y then we have a problem, what is the value of g^{1}(y) ? We require that different values of x yield different values of y. A function with this property is said to be injective.

We need a value of x for all values of y, so g must take the set X to the whole of the set Y. A function with this property is said to be surjective.
A function with both of those properties is said to be
bijective. It's about time to point out the importance of the choice of X and Y (i.e. the
domain and
range of g).
For example
cos is not
bijective from
R to
R, it takes the value 0.3 more than once and it only takes the values between 1 and 1. However,
cos from [0,π[ to [1,1] is bijective. Likewise f(x)=x
^{2} is not
bijective as it only takes positive values and f(x)=f(x), however by considering f to be a function from the positive reals to the positive reals, we can define its inverse function, the
square root.
Functions of the real line
We going to get a bit more concrete here and concentrate on real valued functions of a interval of the reals. If you're wondering about what happens in cases slightly more exciting than the real line, a fundamental result for functions of Banach Spaces is here.
An important observation is:
A continuous function is injective if and only if it is strictly monotonic
The proof of this is quite easy:

If g is strictly monotonic (i.e. strictly decreasing or increasing) on the whole of its domain, then g is clearly injective.

If g is injective, suppose that g is not strictly monotonic.
This means we can find a<b<c with g(a)≤g(b) and g(b)≥g(c) (or g(a)≥g(b) and g(b)≤g(c), but the proof is the same in both cases).
If any of the previous are equalities then g is not injective. If not, then since g is continuous we can use the Intermediate Value theorem to say that on [a,b] g takes all values between g(a) and g(b) and that on [b,c] g takes all values between g(b) and g(c). Hence some values are taken twice, g is not injective. Thus we have a contradiction and so g must be strictly monotonic.
And so a continuous strictly monotonic function is bijective from its domain to its range. Note that if your function is not continuous then this is not true (can you think of a counter example?).
Finding inverse functions
Actually finding an expression for an inverse function is not always easy, but you can draw its graph. The graph of a function g is the set of points (x,g(x)).
The graph of g^{1} is the set of points (y,g^{1}(y)), i.e. a set of points of the form (g(x),x).
Now that's just the previous graph with the order of the coordinates flipped round, and we know that reflection in the line y=x does just that, so you can draw the graph of an inverse function by using this transformation.
  .
 / .'
 / .'
 / .''
 / .'
 / .'
 / .''
 ,' .'
 ,' .'
,' .''
,' .' ...'''
,'  .' ..'''
,.'  .'' ..''
_,.,''  .' ..''
________....,'''  .' ..'
''''''''''''''''''''''''''''''''''.'''''''''''.'''''''''''''''''''''''
.'  .'
.'  :
.''  .'
.'  .'
.'  .'
.''  .'
.'  :
.'  .'
.''  :
.'  :
.' :
.'' :
.' :
.' :
This is a graph of
exp(x),
ln(x) and
y=x, the symmetry in the graph is quite obvious.
Derivatives
Another thing one might want to consider is whether the function is differentiable and what its derivative is. Obviously if the derivative is zero somewhere then the symmetry tells us that the inverse function will not be differentiable at that point. For example the square or cube root functions are not differentiable at 0.
We have the following result:
If g is differentiable, bijective such that g'(x) is nowhere 0 then g^{} is differentiable and g^{}'(x)=1/g' (g^{1}(x)).
For example, if we choose f to be the
exponential function, then we have
exp^{}'(x)=1/exp'(exp^{}(x))
One of the defining properties of the exponential function is its
derivative is itself, so this is in fact
exp^{}'(x)=1/x
exp(0)=1, so exp
^{}(1)=0, so exp
^{} is the
antiderivative of x that is 0 for x=1, i.e.
exp^{1}(x)=∫_{1}^{x}dt/t
This is the usual definition of the natural
logarithm function.