The Price to Earnings Ratio (or P/E ratio), is a very simple idea.
You compute the companies "Earnings" (i.e. profit), and compare it to the "Price" of the stock. So let's say there is a company that just made $2m in profit last year.
They have 100,000 outstanding shares, each at a share price of $50. So if we divide the earnings by the number of shares, we get an "earnings per share" of $20.
The P/E ratio is now 50 / 20 = 2.5.
Another way of looking at this is for the entire company. You see we can compute the "Market Capitalisation" of the company, which is simply the price per share multiplied by the current share price.
If we did this, we'd see that 50 * 100,000 = $5m market cap. If we then divide this by the $2m in revenue, we get the same P/E ratio of 2.5.
So in a way, this number tells us that if we owned the company at this price, it would take 2.5 years for us to "make our money back".
So in many ways, a lower P/E ratio is "better".
Compare this to the idea of "yield". Let's say I had a company that was "yielding" 9% return a year profit (i.e. 9% of the market cap is being paid out as profit per year). Then this would have a P/E ratio of about 11.1.
Again if you think of this it makes sense, if I wait 11 years then my 9% revenue will turn into 99% of the value of the company, so again it's telling me how long I'd have to wait to make my money back.
However
Some companies are growing their revenue, and so it might have a P/E ratio of say, 20 now. But if in 3 years time it is able to double its profits, then the P/E ratio will drop to 10 and it will become a much better investment over time.
So often when you see high P/E ratios, it is a sign of optimism from investors that their earnings will grow. If that optimism wasn't there, then why purchase the stock at all? Why not just buy something that already has a favourable P/E ratio, and not have to gamble on the company earnings going up?
So there is an element of risk involved, in that a high P/E ratio shows that not only do investors believe the revenue will grow, we believe it will grow to outshine companies that already have a good P/E ratio. This is of course not guaranteed at all, and is more of a risky bet.
Other things that could impact your interpretation of this number would be things like, maybe this company is re-investings earnings and try to get growth and so their P/E looks worse than it actually is.
Also there are all sorts of accounting tricks that companies do, and sometimes just outright fraud. So while this number is useful to look at, it's not the be all and end all of investment in the stock market.