With regard to the stock market, legendary investor Bernard Baruch was sure of only one thing: "It will fluctuate." Baruch's remark is the stock market's only guarantee, and it's no less true for the various industries that make up the business environment. No one can time these ups and downs precisely, but paying close attention to which way the economy and market are moving can help you spot great investing opportunities.

Basic economics
All industries and businesses follow the same laws of supply and demand. This concept has never changed and never will, and it follows a clear cycle.

During periods of high demand, high capacity utilization, and increasing operating margins, businesses begin implementing steps to meet the demand. The result usually includes new plant investment, increased product pricing, and increased production -- until supply exceeds demand. Then prices decline, less capacity gets used, and margins shrink. This period continues until -- you guessed it -- the available supply is outstripped by demand, at which point the cycle starts all over again.

For sale by owner
The homebuilding industry offers a near-perfect example of this cycle. After the tech bubble (a cycle in itself), the economy became a low-interest rate environment, making access to capital very easy and cheap. Demand for housing grew rapidly. First-time home buyers found it more manageable to assume loans, and newly minted real estate speculators used the flow of cheap money to "flip" homes. Homebuilders responded by turning out more homes and acquiring land lots at a blistering pace. For years, all was well.

Of course, the clock had to strike midnight sometime. The increased housing production ultimately exceeded demand, and homebuilders like Ryland (NYSE:RYL), KB Home (NYSE:KBH), and DR Horton (NYSE:DHI) now command a fraction of the market values they enjoyed in rosier times. No matter how fine these companies' management teams might be, with supply exceeding demand, it's not difficult to see why these firms have been battered.

In the oil patch
The same situation has playing out with just about anyone involved in energy these days. For years, energy prices languished as supply outstripped demand. But then demand started steadily growing, until oil prices reached nearly $150 per barrel last year.

In the end, the recession stopped that trend in its tracks, causing oil companies like ExxonMobil (NYSE:XOM) and Chevron (NYSE:CVX) to fall dramatically from their 2008 highs. Yet while the prospects for homebuilders seem cloudy for the indefinite future, many still believe that energy prices are now unsustainably low, which could start a new upward cycle both for oil producers and natural gas companies such as Chesapeake Energy (NYSE:CHK) and XTO Energy (NYSE:XTO).

The key takeaway
An old proverb says, "What has risen shall one day fall, and what is fallen shall again rise." Should investors concentrate their efforts on trying to time such cycles? Not at all, Fools -- that's a sucker's game. However, we do think that it's exceedingly important to understand the industries in which you invest, to reduce the chance that you'll make your investments at inopportune times.

As investors, we attempt to buy low and sell high -- but don't confuse that with buying at the absolute bottom, and selling at the absolute top. That level of investing precision is mostly a matter of luck. Instead, Fools are better off focusing on buying underpriced businesses and selling overpriced ones.

Further Foolishness:

Want some help in figuring out whether a beaten-down company deserves your investment? Check out our Motley Fool Inside Value service. Philip Durell, Ron Gross, and their team find great stock opportunities in the depths of Wall Street's bargain bin. Since inception, their picks are beating the market. Best of all, you can see the stocks they're recommending today, and all their past selections, with a free 30-day trial.

This article, written by Sham Gad, was originally published on Jan. 7, 2008. It has been updated by Dan Caplinger, who owns shares of Chesapeake Energy. Chesapeake Energy is a Motley Fool Inside Value pick. Try any of our Foolish newsletters services free for 30 days. The Fool has a disclosure policy.