Everyone is talking about emerging markets these days. It's understandable. Those markets have generated huge returns over the past several years, far above what investors could have made in the U.S. and Western Europe.

But how do you spot a successful emerging market?

We've seen that some countries in southern Africa and central Europe have done very well since the 1990s, yet others there remain mired in economic misery. Let's look at why.

Key ingredients
Economic success is not just a function of natural resources or luck. After World War II, Korea and the rest of Asia had a standard of living comparable to much of Africa. Fifty years later, Asia enjoys huge trade surpluses and a high standard of living for many. Most of Africa, meanwhile, is still stuck in a rut. Why? It's safe to say that prosperity is the result of people and politicians doing things right.

The first essential ingredient in our emerging-markets recipe is a pro-growth government. When the African National Congress came to power in South Africa in 1994, many Western observers wrote it off as a muddle-headed bunch who would ruin the limited economic success South Africa had achieved under apartheid -- in which the government controlled the main state functions and left the white-owned private sector largely free to develop.

Instead, the finance minister and central-bank chief pursued sound macroeconomic policies, while the Black Economic Empowerment Initiative transferred 10% to 20% of the established white corporate wealth to non-white hands. Most importantly, millions of previously disenfranchised South Africans not only had the vote, but they also had access to better jobs, better housing, shopping centers, credit cards, and all of the other amenities an emerging middle class needs to prosper.

What consumers want
So what does a newly minted middle-class professional in a growing emerging market want? A car, a cell phone, a better house, lots of new goodies to put into that house, an occasional vacation, cable or satellite TV, and the like. Many of those things will be bought on the new credit card in our emerging-market consumer's pocket, or it will be financed at the friendly corner bank.

The transition in South Africa was not without its bumps. But the result today is staggering -- a retail explosion that transformed the urban landscape. Banks that hesitated to make loans to blacks before are now begging for their business.

Even though the price of gold is going through the roof, the economic boom in South Africa is not primarily a natural-resources story. Basic materials account for roughly only one-third of South Africa's exports now. That's why the hot plays in emerging markets are not always the natural-resources companies. Look for the banks, the telecommunications companies, the media companies, the retail giants, the construction companies, and the transportation plays. That's where demand is exploding.

The key to South Africa's emergence as a booming market was releasing decades of pent-up craving for a better life and putting the economic framework in place to make it happen.

Easy ways to play South Africa include the iShares MSCI South Africa Index (AMEX:EZA), Sasol (NYSE:SSL), Naspers (NASDAQ:NPSN), MTN, Mr. Price, and Woolworth's.

Success in the middle of nowhere
An African trip might include a stop in Gaborone, Botswana. Back in 1988, Gaborone was a sleepy desert capital city with one decrepit movie theater, a couple of bars and restaurants, a few grocery stores, and one decent hotel. But Botswana is one of the world's largest diamond producers, and the politicians are, mercifully, not corrupt. Botswana obviously had a lot of potential; famous international investor Jim Rogers invested heavily in the tiny Botswana stock market in the 1990s and made out like a bandit as the economy took off.

Now in Gaborone, while the basic road layout is the same, the city is jammed with shopping malls, hotels, banks, and much of the same commercial infrastructure you find in big South African cities. A city that used to have one four-way-stop intersection, which really confused the rural drivers, now has rush-hour traffic jams. You'd barely recognize the place. Imagine living in a quaint cottage, selling it to a new owner, and coming back to find it knocked down and a McMansion in its place.

Many South African companies mentioned above operate in Botswana now. To invest in Botswana's diamond trade, Anglo-American's (NASDAQ:AAUK) De Beers subsidiary partners with local interests in a 50-50 joint venture, Debswana.

Escaping the past
The former communist countries in central and eastern Europe had a tougher task. They weren't just liberating a potential new consumer class; most of their economies had been state-owned and badly managed. In Zagreb, Croatia, in 1992, most shops had gunmetal-gray shelves and distinctly unappealing goods for sale. But that's all there was, so the people put up with it. Asking for more would have landed you in prison in the bad old days.

The new democratic governments had to privatize the hulking state industries and banks, make space for local entrepreneurs, and set the stage for foreign investors to come in and create the high-quality commercial infrastructure that was unknown under communism.

Eastern Europe unfolded much in the way South Africa did. The banks, the telecom companies, and the retailers drove an economic transformation that turned the drab old shopping streets into bright, colorful centers full of goodies that the local shoppers could have only bought abroad before.

Few Eastern European companies are easy to buy on U.S. markets. Closed-end funds such as Templeton Russia and East Europe Fund (NYSE:TRF) and the Central Europe and Russia Fund (NYSE:CEE) are the best ways to go for now.

The flip side
What about the countries that didn't work out? Eleven years after the end of its vicious civil war, Bosnia is still an economic basket case. Why? With little commitment to national unification and real growth, Bosnia is a loose coalition of ethnic fiefdoms, each run by local partisans who block broad economic growth. A few foreign banks and retailers have moved in, but much of the capital city, Sarajevo, retains a Third World atmosphere, with hawkers and beggars working in huge informal markets.

In 2001, Bosnia was one of two countries in Europe without a McDonald's (NYSE:MCD). Albania was the other. Albania eventually got its McDonald's. Today, the McDonald's website indicates that Bosnia is still not on its list of active locations.

Do the right thing
The bottom line: When you are choosing emerging-markets investments, make sure you know the story in the country where you plan to invest. Look for stable pro-growth governments, growing retail activity, and positive stories about the banking, telecommunications, construction, and transport sectors.

Do it right, and you can make a lot of money in strange places that the Wall Street crowd won't discover for years, if ever.

Related Foolishness:

This article was originally published on Feb. 14, 2007; it has been updated.

Sasol is a Global Gains recommendation. Check out the newsletter service free for 30 days to see how it can help you find great investment ideas abroad .

Kristin Graham updated this article, originally written by Dale Baker, and does not own shares of any of the companies mentioned in this article. The Motley Fool has a disclosure policy.