In this type of exercise, the brokerage firm sells just enough of the stock to "cover" the total exercise costs (exercise price + taxes) with the remaining stock held.
Example: You have 1,000 options with an exercise cost of $10,000. The market price of the stock is $20. At exercise, the brokerage firm sells 500 shares for the $10,000 to cover the exercise cost and sells 150 shares for taxes, and you keep 350 shares.
A similar concept applies to restricted stock: shares are sold at vesting to cover taxes. For further reading, see related FAQs on stock options and restricted stock.