How to compute direct images of ramified covering maps? Let $X$ be a smooth projective variety, $L$ a line bundle on $X$, and $s \in \Gamma(X,L) $ a non-zero section whose zero locus $D$ is smooth.
Let $\pi: Y \to X$ be the $n$-sheeted ramified cover given in local coordinates by taking the $n$-th roots of the section $s$.
How do we compute the direct image $\pi_* \mathcal{O}_Y$? In particular, I would like to know why this is a direct sum of various powers of $L$.
A second related question: How do we compute the direct image $\pi_* \mathbf{C}_Y$ where $\mathbf{C}_Y$ denotes the constant sheaf on $Y$ with complex coefficients?
 A: Let us assume that $ L = M^n $ for some line bundle $ M $ and let $ N = M^{-1} $. We'll show that $ \underline{\operatorname{Spec}} (\mathcal{O}_X \oplus N \oplus \cdots \oplus N^{n-1} )$ is the desired $ n $-sheeted cover of $ X $, ramified exactly along $ Y $. The result then follows from the fact that for any quasicoherent sheaf of algebras $ \mathcal{A} $ on $ X $ and $ \pi : Y = \underline{\operatorname{Spec}} \mathcal{A} \rightarrow X $ the structure map, $ \pi_* \mathcal{O}_Y = \mathcal{A} $.
First, the algebra structure on $ \mathcal{O}_X \oplus N \oplus \cdots \oplus N^{n-1} $ is given by the obvious way $ N^i \otimes N^j \rightarrow N^{i+j} $ when $ i+ j < n $ and $ N^i \otimes N^j \rightarrow N^{i+j-n} $ when $ i+j \ge n $ by $ (u,v) \rightarrow suv $. Now it's easy to see that the relative spec is indeed the correct object: Let $ U = \operatorname{Spec} A \subset X $ be an open affine on which $ N $ is trivialized, hence so is $ L $. Since $ X $ is integral, $ L $ is a Cartier divisor so let $ f \in A $ be a local function corresponding to $ L $, i.e. $ Y \cap U $ is cut out by $ f=0 $ on $ U $. Then if $ t $ is a local rational function for $ N $, we see immediately from the algebra structure that $\mathcal{O}_X \oplus N \oplus \cdots \oplus N^{n-1} $ is generated by $ t $ as an $ A $-module with the relation $ t^n = f $ i.e. $  (\mathcal{O}_X \oplus N \oplus \cdots \oplus N^{n-1} )(U) = A[t]/t^n - f $. The last ring immediately shows why the relative spec works: $ \operatorname{Spec} (A[t]/t^n - f ) \rightarrow \operatorname{Spec} A $ is an n-sheeted cover ramified precisely along the zero locus of $ f $.
