Pull up a chair, grasshopper
Fools spend a lot of time analyzing data, comparing financial statements, making calculations on things like growth numbers, cash flow, and earnings. A few even look occasionally at -- gasp -- charts. But amid all the technical jargon and statistical manipulations, I get a question every once in a while that really takes me back to square one regarding the stock market.

Why do stocks rise and fall?

If we strip away all the technical junk and the fancy apparatus associated with the national stock markets (all those electronics, bells, whistles, and suits), what we're left with is -- ta da! -- a market. It is pretty much the same as your local farmers' market on Saturday mornings.

The stock market is a centralized place (although we get to it via computers) where buyers and sellers come together to try to reach a trade. So how does this affect the prices of stocks?

How do you like them apples?
Let's look at an example from your farmers' market. If Farmer Johnson and Farmer Boyer both bring a load of apples to market, the prices they are going to be able to charge will depend on several factors, all tied to the two basic elements of supply and demand.

If you're in the market to buy apples and these two farmers represent your only options (a limited supply), you're going to have to be prepared to pay a little more than if you have five or six other options to choose from.

In addition, the quality of the farmers' respective crops will affect what they can charge. If Farmer Johnson's apples are ripe, firm, and juicy, while Farmer Boyer's apples look a little dried out and past their prime, whose apples are you going to want? Exactly! And as a result, Farmer Johnson can charge more for his apples because the demand for them will be higher than the demand for Farmer Boyer's apples.

Now, what happens when Farmer Johnson's apples are gone? Right again. You're all over this supply and demand thing. When the supply shrinks, whatever demand remains has to be satisfied by Farmer Boyer's supply. As a result, he may be able to raise his prices a little bit because there's no more competition, even though he started out with an inferior product.

Now, he can't charge whatever he wants because the buyer still has the option to go home without apples -- or with another product altogether. But in general the balance between supply (the apples available in the area) and demand (how many customers are craving apples) will determine the price of apples at any given time.

90% psychology, the other half math
The buyer's decision is part mathematical, but let's face it -- a lot of the decision is psychological. How badly do I want apples? Am I willing to pay this much for them today? Am I willing to walk away without apples if the price stays this high? Will I settle for Farmer Boyer's apples?

The exact same principles apply when buyers and sellers come together in the stock market. Something has prompted the potential investor to consider buying shares of a given company. Let's say that you're a loyal Starbucks (NASDAQ:SBUX) customer. You've been drinking their specialty drinks for years. It might be a news story that paints the company in a favorable light. Maybe a third location has just opened in your town and you see the company growing further. It might be a hot tip from a golf buddy. (Let's hope, Fools, this isn't the way we decide.) It might be the result of extensive fundamental analysis telling us that Starbucks represents a good value for the future.

Whatever prompts the interest, the demand has been created for shares of the coffee giant. As for supply, there are a fixed number of Starbucks shares out there, and not all of them are available for sale right now.

The decision on the price a current owner is willing to take, and that a potential buyer is willing to spend, for a share of Starbucks stock, however, is a psychological one. The final decision is really based on perceptions of the company's future prospects, regardless of how one comes to those perceptions.

If a buyer feels that Starbucks' prospects are rosy, he's willing to pay a slightly higher price than someone who thinks the company can't continue to grow at the same rate. Keep in mind that every stock transaction involves both a buyer and a seller. The person buying is psychologically bullish on the stock, but the seller is on the other end of the balance. The tension between them determines the transaction price.

Have we answered yet, what makes prices go up and down? Most of us believe that stocks rise and fall based on the company's earnings. And they do -- in part. But it's not really that straightforward. The price rises for a stock when demand (buyers) exceeds supply (sellers). And likewise, the stock price falls when there are more people trying to sell than there are buyers. Supply and demand -- basic psychology.

So, what does this mean?
The problem for investors, of course, is how to use that market psychology to make a profitable investment decision. Obviously, fundamental analysis is the Fool's first tool. Identify stocks that represent sound business models in strong markets, and you eliminate a lot of stocks. But from within the pool of possibilities, we still have to make the crucial decision about whether the price right now is worth paying.

Despite all our calculations and financial analysis, if the bulk of investors believe the stock is overvalued -- regardless of how they come to that conclusion -- the price will go down. When supply outstrips demand, prices fall.

And we've all seen stocks that shoot up in price, based on absolutely nothing tangible. Investors believe the stock's going to be more valuable, and they want to be in on it. Demand exceeds supply, and the price rises.

So, what's a Fool to do? Start with Foolish analysis. Find good companies, but don't stop there. Pay attention to what the market psychology is telling you. Remember that a stock that falls is a bad investment, no matter how good the company looks on paper. Sometimes the full story doesn't show up in our financial analysis.

So, if you're considering purchasing a stock but the market is consistently hammering it, what's the hurry? Right now, it means that more people want to sell it than want to buy it. Assuming your analysis is good and the company is set for strong and successful growth, by waiting a while, you'll be able to get the stock on sale. You'll be rewarded when the supply/demand balance shifts again and more buyers start becoming attracted to your company.

It's psychological warfare out there. Make sure you know which side is winning the current battle before you throw yourself into the fray.

For related articles:

Fool contributor Robert Sheard, the author of The Unemotional Investor and Money for Life, wishes he had an advanced degree in investor psychology. As addicted to coffee as he is, however, he doesn't own shares of Starbucks, which is aStock Advisorrecommendation.