Shareholder agreements govern the relations among shareholders in privately held firms, such as joint ventures and venture capital-backed companies. We provide an economic explanation for key clauses in such agreements 14namely, put and call options, tag-along and drag-along rights, demand and piggy-back rights, and catch-up clauses. In a dynamic moral hazard setting, we show that these clauses can ensure that the contract parties make efficient ex ante investments in the firm. They do so by constraining renegotiation. In the absence of the clauses, ex ante investment would be distorted by unconstrained renegotiation aimed at (i) precluding value-destroying ex post transfers, (ii) inducing value-increasing ex post investments, or (iii) precluding hold-out on value-increasing sales to a trade buyer or the IPO market.