At its root, what supply and demand says is "if I have a lot of x, and you have a lot of y, we can trade x and y in a ratio we work out according to our respective needs of x and y and everyone will be better off -- we will have aquired a good which we value more in return for a good which we value less." Instead of trading goods, we can exchange money for goods, or services for goods, etcetera, etcetera. The law works whenever there is a scarcity of something which is in demand.

By examining supply and demand, one can theoretically find the most efficient use of the society's time and energy. Not neccessarily the best or most humane, but a pure system of supply and demand will always find the supply / price combination which puts the system in equilibrium -- the point at which supply at a certain price precisely equals demand.

For instance, let's say I sell pet chickens in a small town. I do a poll door-to-door, and find what people would be willing to pay for a chicken (thus finding the level of demand at certain prices), and create a table with that data; additionally, I figure out how many chickens I can afford to produce at certain prices (since I'd have to build more coops, hire more trucks to send chickens out, hire more chicken trainers to make sure the chickens are housebroken, etc). Here's that table:

flamingweasel's chicken monopoly:

|price | # demanded | # supplied |
|------+------------+------------|
| $1   |     100    |     10     | <-- (point 1)
| $5   |      80    |     20     |
| $9   |      60    |     30     |
| $13  |      40    |     40     | <-- (point 2)
| $17  |      20    |     50     |
| $21  |      10    |     60     |
| $25  |       1    |     70     | <-- (point 3)

  • Point 1: Supply < Demand - Well, I'd definitely sell all my chickens, but I'd only make $10. In a market with lots of competition, this may be all I can do (more on that later)

  • Point 2: Supply == Demand, or Equilibrium - Here is the ideal spot, the most efficient use of everyone's energy. I make $520, and the most people get the most goods at the best price for both of us. Once you move off this spot, the transaction is no longer perfectly efficient -- one party is giving up more than the other party is giving up.

  • Point 3: Supply > Demand - Bad place for a seller to be. I've invested a lot of money into producing a whole bunch of chickens, and must raise prices accordingly, but I can only sell 1 at this price. And since chickens aren't very easy to warehouse, this is a disasterous place for me to be.
Now, if there's competition (for example, from ChickenMart moving into my town and opening a store), it's a very different situation (remember, in the table "supply" means the farm can afford to supply this many at that price):

flamingweasel's chicken farm versus ChickenMart:

|price | # demanded | supplied by | supplied by |  total |
|      |            |   weasel    | ChickenMart | supply |
|------+------------+-------------+-------------+--------|
| $1   |     100    |     10      |      20     |   30   |
| $5   |      80    |     20      |      40     |   60   |
| $7   |      70    |     25      |      50     |   75   | <-- (near equilbrium)
| $9   |      60    |     30      |      60     |   90   |
| $13  |      40    |     40      |      80     |  120   |
| $17  |      20    |     50      |     100     |  150   |
| $21  |      10    |     60      |     120     |  180   |
| $25  |       1    |     70      |     140     |  210   |

Notice that now that there's competition in the market, there's a different equilibrium point. However, now that I've got a competitor, I have an interest in making my production more efficient -- if I can make more chickens at a certain price than ChickenMart can, then I can get more of the sales and make more money. The end result of competition would be each farm having the most efficient possible production (I can make more chickens for each dollar I invest), making prices lower (I can meet demand at $5 instead of $7 since my investments were lower) than in a monopoly situation.