Firms in perfectly competitive markets are, by assumption, price takers. Since they produce identical products, trying to get consumers to pay more for a particular company's output will not work. And since each individual company is so small relative to the overall size of the market, their own supply decision will not affect prices at all. In addition, the market will easily gobble up all the product they can produce and sell at the market price.
So what do firms do? They produce output as long as the marginal cost is not greater then the market price. Marginal cost is the cost of producing one more unit of output. If this is lower than price, they will earn a positive return on the sale of that unit. So they keep producing until marginal cost (which eventually must rise) reaches the price. So, given a price in the market, we need only trace it to the firm's marginal cost curve to see how much each firm will produce, which means that the firm's marginal cost curve is also its supply curve. [Astute students of econ will also note that there is a shut down condition to meet - if price is so low that you can only make economic losses - but let's assume that away for the time being]
Note that this is the same as saying that firms produce until marginal revenue (benefit) = marginal cost, which is the profit maximizing rule for all firms. In this case as price is fixed, it is exactly the extra revenue a firm earns from the sale of each additional unit of output, so in perfect competition, price = marginal revenue. In fact just about all economic activity is governed by the marginal benefit = marginal cost calculation, so no matter how you dress it up with math it almost always comes down to an expression of this rule.
Anyway, here is what the firm's supply curve looks like and its optimal output decision depending on the price:
If we add up all such firm's supply curves in the market we will get a market supply curve that looks similar: upward sloping.
So now we have the basics of both sides of the market. Buyers who derive satisfaction from the consumption of the good, and sellers who can potentially make it at a cost that is lower than the monetary value of that satisfaction.
This is a good point to stop and think about this aspect of the story for a moment because it will help later when we talk about the great things markets do. A useful example is a yard sale. You may have a bunch of stuff in your basement or garage that is no longer of much use or value to you. You can provide them for sale at a very low cost - you just set them out and put up a few signs to advertise. There are others out there who may value your items a great deal. Perhaps you have children that are growing and you have baby clothes, furniture and equipment to offload, and there are new parents who really need what you have. Because these new parents value the stuff more than you do, a mutually beneficial exchange is possible. So what do you do, you create a market, allow the high valuers to come and purchase the goods at a price somewhere between their value and your own. [Of course they would like to get a low price and you a high, but any price in between your valuations leaves you both better off than before the transaction] Everyone is better off.
Once we put the market supply and the market demand curves together on the price-quantity graph, equilibrium is easy to describe. People will continue to purchase more of the good as long as there are sellers who can provide it for less than their reservation prices (and vice-versa, sellers will continue to make more and sell as long as they can find people who value it for more than the marginal cost of production). Putting this on a graph looks like this:
Where the P* and the Q* are the market equilibrium price and quantity. Why? Well if price were any higher there would be too little quantity demanded for what the firms were willing to supply, leading to excess supply. Firms would start cutting price to find willing buyers and price would go down. If price were any lower there would be too much demand and too little supply, or excess demand, and buyers who couldn't find any of the good would start to offer more.
Next time, in Part 3, I'll go over the performance of the market, describing why markets are so great, as well as discuss a few of the possible market failures (assumptions that fail to hold) and what the implications are for the 'great' outcomes of the market.