This paper provides a theoretical model for the coattail effect, where a popular candidate for one branch of government attracts votes to candidates from the same political party for other branches of government. I assume a political agency framework with moral hazard in order to analyze the coattail effect in simultaneous presidential and congressional elections. I show that coattail voting is the outcome of the optimal reelection scheme adopted by a representative voter to motivate politicians' efforts in a retrospective voting environment. I assume that an office-motivated politician (executive or member of congress) prefers her counterpart to be affiliated with the same political party. This correlation of incentives leads the voter to adopt a joint performance evaluation rule, which is conditioned on the politicians belonging to the same party or to different parties. Two-sided coattail effects then arise. On the one hand, an executive's success props up, while failure drags down, her partisan ally in the congressional election, which implies a presidential coattail effect. On the other hand, the executive's reelection itself is affected by a congress member's performance, which results in a reverse coattail effect.