This paper examines multi-battle contests whose extensive form can be represented in terms of a finite state machine. We start by showing that any contest that satisfies our assumptions decomposes into two phases, a principal phase (in which states cannot be revisited) and a concluding tie-breaking phase (in which all non-terminal states can be revisited). Degenerate cases are the finite-horizon contests on the one hand (e.g., the match race), and the tug-of-war on the other. Next, assuming a probabilistic technology in each battle, we show that any contest satisfying our assumptions, with either finite or infinite horizon, admits a unique symmetric and interior Markov perfect equilibrium. This entails, in particular, a complete characterization of the equilibrium in the tug-of-war. Finally, we explore, both analytically and numerically, the intricate problem of a contest designer that maximizes expected total effort. In the absence of a complexity constraint, the revenue-maximizing contest is always a match race, where the optimal length of the race increases as the technology of the component contest becomes more noisy. If, however, the complexity constraint is binding, then the optimal contest is typically (but not always) a tug-of-war.