In modern finance theory, there is no difference between valuing a dividend-payer stock versus a non-dividend payer. In theory, both kinds of stocks will be worth the sum of their future free cash flow, discounted at an appropriate rate.
In the figure below, we represent a money flow from a company's earnings to you, directly into your pocket. Assume the company earns $15 per unit of time, say per quarter. Upon earning money, the company declares a dividend of $10 (a 67% payout ratio). At time zero, let's say you have zero dollars and the company has $30. It then decides to pay $10 dividend. After paying the first dividend the company now has $20 and you have $10.
Then, the company earns another $15 and pays you $10. You now have $20, and the company has $25. And so on. At the end of 5 quarters, you've accumulated $50.
For simplicity, let's say that the company ceased to operate and the cash remaining in its coffers went to pay debt. You would get nothing else at liquidation, but you kept your $50.
How would you value this company at time zero?
Well, I would sum up all the cash flows to me and discount it at some rate. For simplicity, let's say the discount rate is zero. So the total worth of this stock to me is exactly $50, since that's what I will get out of it.
Now, assume the same company didn't pay you a dividend, but instead kept it in its savings account. The figure below illustrates the cash flow, just this time you get nothing all along, until the company liquidates, pays you the same 67% payout , in excess of what it owes, and uses the rest to pay the creditors.
You would get your same $50 and the company would keep $55, which it would use to pay creditors. So the valuation of this company must be the same as the one before: $50 (again, ignoring the discount rate).
So, in theory, the value of a company is independent of whether or not it pays a dividend. Some would even argue that dividend payers should be valued even a little lower, since you as a shareholder have to pay taxes on the dividends you get, while the company gets to keep it tax free (well, not quite tax free, it pays corporate taxes, but you as the shareholder get to keep more money in the company's coffers if it doesn't pay a dividend, due to the double-taxation system).
But what's the problem with this reasoning? There are many. The most important one is that unless you know and trust management, how can you be sure you will eventually get money out of a company? You don't. In many cases, management sees a pile of money and decides to expand their empire and buy other companies -- at usually very unreasonable prices. Other examples of malinvestments abound, such as throwing money at losing product lines, paying out huge bonuses to themselves, blatant theft (see Financial Statement Analysis for how to spot "cooking" of books by crook managers).
Cash, inventory, patents, equipment and market share can all go away quickly. A company's attractiveness can vanish due to poor management or adverse economic times. Having a history of dividends can help an investor put a value on a stock and get paid while he holds his investment.
On the other hand, paying out a dividend when the company can't afford it is a bad idea and one should avoid buying companies that need to borrow to sustain their dividends. Moreover, the dividend can be cut and vanish just as quickly as the company can be mismanaged, so be careful not to over-emphasize dividends in your evaluation. As we've seen, the potential to pay a dividend in the future is almost as valuable as having one now, as long as your confidence in the company not destroying what it has built is very high.
In conclusion, dividends provide an interim return, which I see as the price I should be paid to invest in a company. Whenever two securities are roughly equally attractive to me, the one with the dividend will always win. However, limiting oneself to only dividend payers is a mistake. One should invest in sound companies with sound management and with decent prospects of earning money.