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 -- which represented 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 Toll Brothers (NYSE:TOL), Pulte Homes (NYSE:PHM), 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 played out last year with energy stocks. For years, oil 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 ConocoPhillips (NYSE:COP) and BP (NYSE:BP) to fall dramatically from their mid-2008 highs. Yet while the prospects for homebuilders seem cloudy for the indefinite future, oil prices have rebounded from their lows, which could start a new upward cycle both for major oil producers as well as independent players like Anadarko Petroleum (NYSE:APC) and Devon Energy (NYSE:DVN).

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.

Anand Chokkavelu knows that being smart won't make you rich. Find out why and take steps to avoid disaster in your portfolio.

This article, written by Sham Gad, was originally published on Jan. 7, 2008. It has been updated by Dan Caplinger, who doesn't own shares of the companies mentioned. Try any of our Foolish newsletters services free for 30 days. The Fool has a disclosure policy.