Firms offer highly complex contracts to their employees. These contracts contain a mix of incentives, such as fixed wages, bonus payments, promotion options, and layoff threats. In general, economists understand how incentives motivate employees but not why a particular mix should be used. In this paper we present a model in which the observed incentive mix is an optimal contract. In particular, we show that it can be optimal for firms to combine cost-efficient incentives such as promotions and bonuses with layoffs. The intuition is that layoffs play a dual role. First, they create incentives for the employees. Second, they contribute to sorting and selection. In the empirical part of the paper we test the model's basic assumption about employee sorting and selection together with its broader predictions about employee careers. Using personnel records from a large international pharmaceutical company, we find that the model's predictions are consistent with the data.