One thing that often trips up investing beginners is the fact that stocks move in and out of favor. At no time has this phenomenon been clearer than during the first few weeks of 2012. When you look at the stocks that are doing the best so far this year, you'll find a disproportionate number of them did particularly badly last year. So what's behind this rotation into last year's "junk" stocks, and what does it mean for your portfolio this year?

Going from worst to best
The stock market has opened 2012 on a high note, with broad advances so far throughout the month of January. But when you look at which stocks are contributing the most to that performance, you'll find something interesting. Among the members of the S&P 500 index, 74 stocks -- roughly 15% of the total -- have had returns of 15% or more. But when you drill down on the 50 worst-performing stocks in the S&P last year, you'll find a much higher proportion of 15%-return stocks: 22, or about triple the rate of big gainers in the overall S&P.

That's consistent with the idea that investors look to beaten-down stocks for new ideas while jettisoning better-performing stocks once they've delivered sizable gains. But let's take a closer look at some of the these rags-to-riches companies to see if we can identify any consistent traits that could be useful in figuring out which stocks will be the next top performers.

The best of the worst
Among the top performers from last year's big loser list, Sears Holdings and Netflix (Nasdaq: NFLX) top the charts. But the reasons for the gains are as different as what got them into their respective messes to begin with.

At the beginning of 2011, Netflix looked like it was on top of the world. But after a huge run, the company made a huge mistake, and it spent the remainder of last year paying for it, losing more than three-quarters of its value. Since then, though, the video-delivery giant has done its best to repair the damage it did and secure new subscribers both in the U.S. and abroad. The market has rewarded investors for their patience with a 37% return.

With Sears, on the other hand, the retailer's troubles have been around for a long time. Although the problems reached a head when the company reported terrible holiday sales, huge losses, and store closings, Sears has struggled for a long time -- and investors should have been prepared for it. Gains this year have come not from any sense that fundamental problems at the company will disappear, but rather in the hopes that insiders like Eddie Lampert will take Sears private, paying a premium to existing shareholders. That's been worth a 41% jump for shares in 2012, but the upside looks pretty limited from these levels.

The same ol' story
Other stocks share similar stories. Among financials, Bank of America has led the Dow higher with improvements in its capital ratios and credit-loss provisions. Regional bank Regions Financial (NYSE: RF) has used a similar strategy, announcing earlier this month that it would divest its investment and brokerage division to raise $930 million. Also shedding assets to boost shares was Genworth Financial (NYSE: GNW), which said it would sell its tax and accounting financial advisor unit to focus on its core asset management business.

But the good news goes beyond Wall Street. Freeport-McMoRan Copper & Gold (NYSE: FCX) has both benefited from a big turnaround in metals prices and fixed its labor situation with new agreements with workers in place, reversing 2011 concerns that emerging-market growth would stall and lead to weakness for the company. And Advanced Micro Devices (NYSE: AMD) has jumped almost 25% this year on solid earnings that stem from both record sales of chips for laptops as well as good performance for its server chips.

Be careful out there
Beaten-down stocks can be lucrative opportunities, but you'll find many traps for the unwary among them. Before you decide to buy, make sure you understand why you're buying -- whether it's for a quick short-term bounce or the true long-term prospects for the company. Without knowing that, you could easily get stuck not knowing what to do if the stock turns back downward.

The easier alternative is simply to pick stocks that have long-term promise. Let me invite you to read The Motley Fool's latest special report to discover the names of three stocks with huge profit potential over the long haul. It doesn't cost a dime -- but grab it today while it's still available.