Utility is also used as an abstract concept in economics. It
signifies how much benefit a person has from
owning/buying a thing. To really understand how supply
and demand work, you have to first understand utility which is one
of the factors determining demand.
One of the first assumptions in economics is that all
people (called 'economic subjects') are acting
rational. This is defined as everyone trying to maximize
the utility (e.g. money, goods, recognition,
happiness, ...) he trades in for the limited amount of
resources he owns (labor, money, goods,
recognition, ...). We will focus now on the consumer, who tries to
trades in money for goods. Please note that there are a few
constraints and preconditions to the
rationality principle, but I will skip these.
Maximizing the utility of bought goods of course means that there
must be an order of preference between these goods or, to be
more correct, between different bundles of goods (also called consumption bundles). If
e.g. a cotton candy(cc) cost $2, a roller coaster(rc)
drive $3 and you had $15 to spend on the fair, you could buy
the bundle (1cc,4rc,$1), (2cc,3rc,$2),
(3cc,3rc,$0), .... or (6cc,1rc,$0
and some vomiting). You will prefer some of these bundles
over others and we assume that these preferences put up a total
order between these bundles ('total order' is just a magic word from
mathematics saying that there is a '<' relation behaving exactly
as you would expect from it :).
With q_{i} being an arbitrary bundle and Q the set of
all bundles we can now define the utility function u: Q >
R^{+} (i.e. it is a function which assigns to each
bundle of goods a positive real number). It is defined using the
preference relationship '<' defined above:
u(q_{1}) < u(q_{2}) <=> q_{1} <
q_{2} (i.e._{ }the utility value of bundle 1 is lower
than the utility value of bundle 2 if and only if bundle 1 is less
preferred than bundle 2)
Two remarks: First, please note that the first '<' is a
comparison between numbers while the second '<' is a comparison
of bundles (it's difficult to use different signs for that with
HTML). Second, if you know anything about math you are probably
already complaining "That is no real definition, how do I
calculate u(q)?". Well done, you're correct! We don't know how
to calculate the utility function ..... and we don't need to. The
only things needed to know are a few of its
characteristics:
 Ordinality:

The values representing utility can be arbitrarily chosen (within
the restrictions given by the above 'definition'). This means that
if u(q_{1})=2*u(q_{2}) you are not allowed to
conclude that q_{2} has the double utility (benefit) than
q_{1}. You are only allowed to conclude that it brings more
benefit. This also means that you can not compare at all the utility
numbers two persons each assign to a bundle of goods. (This is of
course the reason why there is no algorithm to calculate u(q))

Insatiability:

The utility function is monotonically increasing. In less mathematical
terms this means that getting more of something while at least
getting the same of everything else provides you with more utility.
So two cotton candies are better than one, and three are better than
two, ... and 1001 better than 1000 (uhmm, well, nobody ever claimed
economics to be totally realistic).

Decreasing marginal utility:

The second derivative is negative. As you have already seen in the
example above the additional utility of every additional unit of
a good you get is decreasing. So whereas getting 5 cotton candies
as a present while expecting 4 is a nice surprise, getting 2 while
expecting 1 is a much nicer surprise. (Please do not start sending
in cotton candies now.)
OK, now with these characteristics, what do we gain from having an
utility function, which we can not even calculate. Well, we gain two
things. First the graphs of the overall utility
function u for a single good and of the utility u' of the last added
unit of that good (i.e. the derivative of u).
u /\ u' /\
 ******* *
 ***** *
 **** *
 ***  *
 **  *
 **  **
 *  **
 *  ***
 *  ****
*  *****
*  ********
> >
q q
Now, have a look at the graph for the utility of the last added good
(the right one). The more of a good you have, the less you
value the latest unit. This looks a lot like the graph of the
demand curve which shows that more of a good is demanded by the
customers the less it costs (in the standard case). This similarity
is not the whole truth (more (in a few days) under demand) but if
you just want to understand things on a high level, it is enough to
remember that one has to lower the price to create more demand
because people value another unit of the same good less than the
previous units and therefore pay less for it. You can also stop
reading now.
The second thing we gain from the utility function is the
ability to determine how combinations of goods behave
which a person values the same. We can arrange all equallyvalued
combinations on a curve which is called indifference curve (for
combinations of two goods, for more goods its is less of a curve
and more of a hyperplane). You can choose several levels of
utility and draw an indifference curve for each of them into one
diagram. Normally (!) this will look somehow like the
following:
q1/\
 * * *
 * * *
 * * *
 * * *
 * * **
 * * **
 * ** ***** u3
 ** ***
 ** ***** u2
 *** u1<u2<u3
 ***** u1
>
q2
The indifference curves are not allowed to intersect (due to the
transitivity of the preference relation) and higher utility levels
will always be found to the right and/or up (due to insatiability) .
The above graph also tells you e.g. how much more of good q1 a person
wants as a replacement for one unit of good q2. This if further
explained under substitution.
To determine demand we will draw the line representing the
available money of the person (called budget line) into this
curves. The point at which this line touches the highest
possible indifference curves determines the demand of the person for
these two goods given that nothing changes. Since changes
are of course the interesting case (i.e. we want to know how demand
for a good changes if its price changes) you should continue to
read at demand (in a few days). You will also
learn there how to draw the budget line.
Please note that I only minored in economics,
that that has been some time ago and that I'm a native German
speaker. So the above might contain passages being
arbitrary wrong , outdated or using the wrong
phrases. Don't copy this as a homework!