Considering that I live in Las Vegas and report on casino companies for The Motley Fool, it's probably not all that surprising that I've done a bit of wagering at the casinos myself.

Most of what the casinos have to offer I don't bother with. Most games are set up so that no matter what you do, the house always has the edge. Always. Oh, you can win, but stay at the table or the machine long enough and you'll always end up paying it right back.

Horse racing, however, uses a pari-mutuel betting system, which basically means that bettors are competing against each other rather than the house -- so the odds aren't automatically stacked against you. What I've found even more interesting about horse racing, though, is that there are important lessons that we can shovel up and bring over into the investing world.

The best horses usually win
It almost sounds too obvious to mention, but much of the time the best horses take the top spots in their races. These are the horses that have shown the top speed, have previously raced against the toughest competition, and have the best trainers and jockeys working with them.

Similarly, the stocks of the best companies tend to perform well year after year. Berkshire Hathaway's (NYSE:BRK-A) stock, for instance, is up more than 1,000% over the past 20 years. It's not particularly hard to see why; the company owns a collection of superb operating companies and has Warren Buffett sitting at the helm.

Coca-Cola (NYSE:KO) has provided its shareholders with average annual returns of around 12% over the past three decades. Again, it doesn't take brain-bending analysis to figure out why Coke's stock has been so successful. Coke is simply a great company that sells a product that people around the world can't do without. In other words, it's one of the best horses in the field.

Valuation matters
Now that I've told you that the best horses usually win, it's time to couch that by saying that the best horses don't always win. Sometimes a good horse runs a bad race and ends up in the middle of the pack, or another horse could run the race of its life and edge the favorite by a nose.

For this reason, it's important to make sure that you're getting odds that compensate you for the risk you're taking. If you always settle for low odds, then your winning horses will pay you very little and your losers will sink you.

Horse racing expert Steven Crist spoke at a Legg Mason investing conference in 2007, breaking it down very simply for thoroughbred handicappers -- and investors:

What you really want to do is determine which most-likely winners are good prices and which most-likely winners are bad prices. It is a very simple equation: Price x Probability = Value

Bringing this to the investing world, we can look at Amazon.com (NASDAQ:AMZN), which currently trades at nearly 50 times its estimated 2009 earnings. It's not much of a leap for me to say that Amazon is a great company, but it's highly debatable whether the probability of continued stellar growth justifies that hefty multiple.

On the flip side, UnitedHealth (NYSE:UNH) has seen its stock knocked down to a price-to-earnings ratio of less than 8. There's little doubt that the company faces significant headwinds from the economy, but the stock's valuation is attractive enough that the company doesn't have to grow very much for investors to be handsomely rewarded.

Buying stocks with high valuations will often lead to modest gains from companies that continue to do well, but those wins can be offset by disastrous losses from the stocks of highly valued companies that get tripped up. This is why you'll lose money by betting only on the favorites at the track. Buying stocks with more attractive valuations, on the other hand, offers the potential for larger gains on the upside and more moderated losses on the downside.

Quality, meet value
Putting the two concepts together, we can find an ideal strategy for horse racing or investing: Bet on the best horses (buy the best companies) when the betting public (other investors) has provided attractive odds (low valuations) and watch your bankroll (portfolio) grow.

This quest for quality at an attractive price can be very difficult due to the sheer number of investors following giant companies like ExxonMobil (NYSE:XOM) -- a $300 billion enterprise that sees nearly 30 million shares trade hands every day. It's very difficult to have an informational advantage against the thousands of other investors in this oil behemoth.

However, the advisors at our Motley Fool Hidden Gems newsletter have found that by searching among lesser-known small-cap companies, some sweet price/quality combinations can be found. Just like the sharp railbirds at the track, they do far more research and have much better information than most small-cap players.

Over Hidden Gems' six-year existence, the team has identified companies such as commercial food service equipment specialist Middleby (NASDAQ:MIDD) and seat belt and airbag king Autoliv (NYSE:ALV). While both companies are leaders in their respective niches, their small size allowed them to fly under the radar and sell at attractive valuations.

And if you like the look of those two, you can check out the rest of the Hidden Gems picks by taking a 30-day free trial of the service.

Even if you decide not to check out Hidden Gems, you can still take away this great lesson from the race track: You'll find the most investing success by searching out the highest-quality companies sporting the most attractive valuations. It's as simple as that.

Amazon.com, Berkshire Hathaway, and UnitedHealth Group are Motley Fool Stock Advisor selections. Berkshire Hathaway, Coca-Cola, and UnitedHealth Group are Motley Fool Inside Value selections. Coca-Cola is a Motley Fool Income Investor recommendation. Autoliv and Middleby are Motley Fool Hidden Gems recommendations. The Fool owns shares of Middleby, Berkshire Hathaway, and UnitedHealth Group. 

Fool contributor Matt Koppenheffer owns shares of Berkshire Hathaway and Coca-Cola, but does not own shares of any of the other companies mentioned. You can check out what Matt is keeping an eye on by visiting his CAPS portfolio, or you can follow Matt on Twitter @KoppTheFool. The Fool's disclosure policy thinks Matt was crazy for going with Chocolate Candy at the Belmont Stakes -- Dunkirk was the obvious pick.