The first thing to understand is that when shares are given to an employee or investor, they aren't taken from someone else -- they are newly created shares -- the pie gets bigger. Of course, your slice of this newly enlarged pie is now a smaller percentage of the total. That's dilution. A lot of people understand that. What they often don't understand is deeper in the details.
I'll explain using a simple example of a company raising a few rounds of investment.
To begin, let's say that the founders decide to join Y-Combinator, and YC asks for 6% equity and a 20% option pool (please note: these numbers are just an example -- every company is different). For simplicity, let's start with 100,000 shares.
Next, the startup raises a little money from an angel investor: $100,000 at a $2,000,000 pre-money valuation. The "pre-money" is simply the value of the company before the new investment. Since there are 100,000 shares and the company is worth $2,000,000, we calculate the share price to be $2,000,000 / 100,000 = $20. Since the angel is investing $100,000 at $20/share, he will get 5000 shares. (Sometimes these early angel investments are done with a convertible note instead, but for this example we're just going to issue new stock)
That was easy. Now let's get some VC money! What's the company worth? Surprisingly, the answer seems to depend a lot on how much money they are raising. For some reason, a common pattern is that the first major VC round will take about 1/3 of the company. Let's do $5 million at a $10 million pre-money. Also, the option pool should be increased to 25%. That seems like no big deal since it started out at 20%, right? Wrong. They want it to be 25% of the newly financed company -- dilution is making that old option pool too small percentage-wise. In fact, the number of shares in the option pool is going to increase by 225%!
The company started with 100,000 shares and by now there are 204,000. Surprisingly, although the VC only took 1/3, everyone else's stake was cut in half. Also, notice that while the option pool is unused, the the VC owns (68,000 / (204,000 - 51,000)) = 44% of the outstanding shares.
What happens if the company decides to raise more money? That will depend a lot on how successful their business is. If it's a huge success and they barely even need the money (something like Facebook), then they can raise money at a very high valuation and have very little dilution. On the other hand, if things aren't going so great and they're desperate for cash, they may end up being forced to raise money at a valuation closer to $0 (I believe this is known as a "cram down"). That will cause massive dilution and basically wipe-out all of the previous owners. Not good. Employees may be offered additional options to keep them from leaving, but for any investor not participating in the new round, it will be a near-total loss.
One last detail: the investors will almost certainly hold "preferred stock" which gives them a number of special rights. For some reason, those rights seem to be slightly different for every deal, but expect there to be a liquidation preference guaranteeing that the investors get their money back (and perhaps a profit too) before anyone else gets anything. If the company in the above example were acquired for $5 million, that money would all go to the investors, and possibly only the VC investor if they included terms giving themselves priority over the earlier investors.
I hope this is helpful. Please let me know if I've made any errors in my examples or explanation. My goal for this post was to make the numbers behind startup equity a little more familiar and intuitive.
The question that I haven't addressed: Is it a good idea to give away 64% (or more) of your company? The answer: it depends. 36% (or 10% or 1% or 0.1% or 0.01%) of something big is worth a whole lot more than 100% of nothing, which is what you'll probably end up with if you are overly focused on retaining ownership. Your primary concern needs to be building a great product and a great company. If you can significantly improve your odds of doing that by giving partial ownership to investors, advisers, and employees, then that's what you should do. Of course you don't want excessive dilution, that's not good for anyone, but there is a healthy middle-ground.
Another fun example: In 1999 Google raised $25 million from Sequoia and KP at a $75 million pre-money valuation, meaning that the VCs together got 25% of the company (about 12.5% each -- I think there may have been a few smaller investors in there too though). That was exceptionally good. Supposedly, John Doerr was heard to say, "I have never paid more money for so little a stake in a startup." (source) By the time of the Google IPO filing, Larry and Sergey each owned about 15.6% of the company (from the S1). Sequoia and KP each had 9.7%. Considering that Google went public with a valuation around $30 billion, and has since risen as high as $150 billion, that was pretty much the best-case scenario for everyone involved. At today's price of $445/share, a 0.1% slice of Google would be worth $138 million!
Update: On news.YC, chandrab pointed out this nice VC dictionary, which explains liquidation preferences and the like.