Higher dimensional version of the Hurwitz formula? In Hartshorne IV.2, notions related to ramification and branching are introduced, but only for curves. The main result is the Hurwitz formula. 
Now if you have a finite surjective morphism between nonsingular, quasi-projective varieties, then the notion of ramification (divisor) would still make sense and we can also still talk about the degree of a canonical divisor. It also seemed to me like no result in IV.2 really uses the fact that $X$ and $Y$ are of dimension $1$. So I ask, can I replace $f$ by a finite, dominant, separable morphism $X\to Y$ of nonsingular, quasi-projective varieties of arbitrary dimension? That is, of course, up to and including Proposition 2.3. 
If this is so, can we say anything about the degree of a canonical divisor in dimension greater than one? Maybe in special cases?
 A: There is a more general version based  on the trick called integration with respect to the Euler characteristic which reduces  the problem to Hurwitz formula for possibly  singular curves. In this approach complex analycity  plays a secondary role.   The story is a  bit too long  to include it here   since it requires a brief digression into  tame geometry, a.k.a.  o-minimal geometry  amongst  logicians.   
If you have  half an hour to an hour to   spend, take a look at this paper to see what this trick is about and see a few rather surprising topological consequences.
A: One could argue that Hurwitz's formula boils down to two simple facts:


*

*If $f:X\to Y$ is an étale morphism, then $\omega_X=f^*\omega_Y$.

*If $f:X\to Y$ is dominant, then $\omega_X\supseteq f^*\omega_Y$


"1." is a trivial consequence of an equivalent characterization of being étale, namely that $f$ is flat and $\Omega_{X/Y}=0$ (see Hartshorne, Ex.III.10.3). 
"2." follows from taking any local section of $\omega_Y$ and realizing that pulling it back via $f$ (that is, substituting the change of variables given by $f$ into the local variables) one gets a regular form again.
If $f$ is as in the question, then it is étale away from the ramification locus essentially by the definition of the ramification locus (which is a divisor by purity as pointed out by Christian). Then "1." implies that $K_X=f^*K_Y+R$ for some divisor supported on the ramification locus and "2." implies that $R$ is effective. 
The actual coefficients of $R$ and the ramification indices depend on local information. Localizing at the general points of the irreducible components of the ramification locus reduces the question to the case of curves.  

Regarding the question of the degree of the canonical divisor, I'd say something different than what has been said above. True, a notion of degree as in the case of curves does not exist in general, but if we examine what that notion on curves really is we may be able to come up with similar notions that could work just as well.
If you think about it, the main reason we can define a degree of divisors on curves is that there exists a single (effective) divisor, namely a point, such that every divisor is numerically equivalent to a multiple of this one and then we just call that multiple the degree of the divisor. 
In other words, if $X$ is such that the group of divisors modulo numerical equivalence is $\mathbb Z$, then one could define degree of $D$ as the number it maps to when considered via this isomorphism. This is what happens for example when we talk about the degree of a hypersurface in $\mathbb P^n$.
Another way of thinking about degree is that it is an intersection number. It is customary to define the degree of a projective variety (with respect to a given projective embedding) by the number of points in an intersection of the given variety with a complementary dimensional linear subspace in general position. For a divisor this would mean intersecting with a line in general position (or just take the intersection number with a line). 
Of course, a general variety will not contain a line, but one may do the following: Fix an ample divisor $L$ and define the degree of a divisor as $D\cdot L^{n-1}$ where $n=\dim X$. In many cases this will work fine and whatever you would use the degree of the divisor, this would give you the same framework.
So, I would say that the problem with the degree of the canonical divisor is not that it doesn't exist, but that in general any definition of a degree of a variety involves some choices and hence one may end up with more than one notion of degree. However, with respect to Hurwitz's theorem, if you want to use degree to compare $K_Y$ and $K_X$, you should still be able to get something useful, since all you have to do is to make sure that you use compatible notions of degree on $X$ and $Y$. For instance, if you follow the degree determined by an ample line bundle, then just take one on $Y$, pull it back to $X$. Since $f$ is finite, this will be ample and the two notions given by the two line bundles will be compatible. In fact, go ahead and write down the degrees of the divisors in the Hurwitz formula this way. You will end up with a similar (but different!) formula. The degree of $f$ will enter also via the pull-back of the ample line bundle, so perhaps to get a more familiar formula, you would have to divide all degrees on $X$ by the degree of $f$ (or multiply them by it on $Y$).
The obvious downside of defining degree this way is that it is not portable. You can define it in a given situation and try to make you definitions on different objects to be compatible, but you cannot expect to get any numerical results that remain true in a different situation. For instance you cannot 
say absolute things like "the degree of the canonical divisor is $2g-2$".
A: degree of the canonical divisor doesn't make any sense as already pointed out by Mohammed. 
On the other hand, by "purity of the branch locus", the branch locus, as well as the ramification locus of $f$ is a sum of irreducible divisors. Denote by $R_i$ the irreducible components of the ramification locus. Then, the local rings of the generic points of the $R_i$ are DVR's, and one can associate ramification indices $e_i$ to them (as explained in Hartshorne's book). Local computations show that
$$
\omega_X \cong f^*\omega_Y\otimes{\cal O}_Y(\sum_i (e_i-1)R_i)
$$
In fact, one checks this outside the intersections of the $R_i$, where these local computations are easy. This gives the desired isomorphism outside codimension $2$, and by reflexivity, the desired isomorphism holds everywhere.
A: Over $\mathbb{C}$, we can easily obtain a Hurwitz formula for higher dimensional varieties by topological methods.  Suppose $f:X\to Y$ is a finite map of complex projective varieties; say it has degree $d$.  Let $B\subset Y$ be the branch locus, and put $Z = f^{-1}(B)$.  The induced map $X\setminus Z\to Y\setminus B$ is then a $d$-sheeted covering space, so we find $\chi(X\setminus Z) = d\cdot \chi(Y\setminus B)$.  But $\chi(X\setminus Z) = \chi(X) - \chi(Z)$ (the fact that $Z$ has even real codimension in $X$ is crucial here), so we obtain
$$\chi(X) = d\cdot \chi(Y) +(\chi(Z) -  d\cdot\chi(B)).$$
Observing that for a curve $C$ we have $\chi(C) = -\deg \omega_C$, this formula clearly reduces to the well-known Hurwitz formula in the curve case.  In higher dimensions, we now have an induced finite map $Z \to B$, and we can recursively obtain a formula for $\chi(X)$ by analyzing the ramification of this map.
As an application, this method gives a simple derivation of the Euler characteristic of a smooth degree $d$ hypersurface in $\mathbb{P}^n$.  Indeed, any such hypersurface is diffeomorphic to a Fermat hypersurface $x_0^d+\cdots + x_n^d = 0$.  Considering projection from a point, the branch and ramification loci are themselves Fermat hypersurfaces, and a recursive formula can be obtained.
A: Here is a lighthearted attempt at generalizing the discussion of Hurwitz' formula in Hartshorne to higher dimensions.
Let $f:Y\to X$ be morphism of schemes over a field $k$. Assume that $X$ and $Y$ are integral and smooth of dimension $n$, and that $f$ is finite, dominant and separable.
Consider the exact sequence
\begin{equation*}
f^* \Omega_X \to \Omega_Y \to \Omega_{Y/X} \to 0.
\end{equation*}
Separability of the extension of fields $k(X)\subseteq k(Y)$ is equivalent to the vanishing $\Omega_{k(Y)/k(X)}=0$. Thus the map $f^*\Omega_X\to \Omega_Y$ is surjective at the generic point of $Y$. It follows that it is also injective there, since the two sheaves involved are locally free of the same rank. We conclude that $f^*\Omega_X\to \Omega_Y$ is injective everywhere,  since $Y$ is integral.
Exterior powers of injective maps of modules that are finite and free over a ring are again injective. Thus the natural map $f^*\omega_X\to \omega_Y$ is injective. Tensoring with $\omega_Y^{-1}$, we obtain an invertible ideal sheaf $f^*\omega_Y\otimes \omega_Y^{-1} \subseteq \mathscr O_Y$. The corresponding effective Cartier divisor $R$ is called the ramification divisor of the cover $f:Y\to X$. By construction there is a natural isomorphism $f^*\omega_X(R)\xrightarrow\sim \omega_Y$. 
Let $P\in Y$ be a point of codimension 1. We next show that
\begin{equation*}
\operatorname{length}_{\mathscr O_{Y,P}}\mathscr O_{R,P} = \operatorname{length}_{\mathscr O_{Y,P}} (\Omega_{Y/X})_P.
\end{equation*}
(I apologise in advance for the inelegant proof.) 
This will imply the Weil divisor associated with $R$ is
\begin{equation*}
\sum_{F\subseteq Y} (\operatorname{length}_{\mathscr O_{Y,F}} \Omega_{Y/X}) \cdot F,
\end{equation*}
where the sum runs over all prime divisors of $Y$. In particular, the complement of $R$ in $Y$ is the largest open subset restricted to which $f$ is unramified.
Denote $A:=\mathscr O_{Y,P}$ and let $t\in A$ be a uniformizer. Choose bases around $P$ for the rank-$n$ locally free sheaves $f^*\Omega_Y$ and $\Omega_Y$. The map $(f^*\Omega_Y)_P\to (\Omega_X)_P$ is then given by a matrix $\alpha$, which we may assume to be in Smith normal form:
\begin{equation*}
\alpha =
\begin{bmatrix}
t^{a_1} & & \\
& \ddots & \\
& & t^{a_n}
\end{bmatrix},
\end{equation*}
where the $a_i\ge 0$ are integers. Here there are no zeroes along the diagonal because $\alpha$ tensored with $\operatorname{Frac}(A)$ must be surjective. It easy to see that
\begin{equation*}
\mathscr O_{R,P} \cong A/(\det \alpha) = A/(t^{\sum a_i}),
\end{equation*}
while 
\begin{equation*}
(\Omega_{Y/X})_P\cong \oplus_{i\ge 0}^n A/(t^{a_i}),
\end{equation*}
so these two modules have the same length $\sum a_i$.
Let $r(P)$ be the ramification of $f$ at $P$: this is the valuation of the image of any uniformizer of $\mathscr O_{X,f(P)}$ in $\mathscr O_{Y,P}$. Assume that the characteristic of $k$ does not divide $r(P)$, that the finite field extension $k(f(P))\subseteq k(P)$ is separable, and that the finitely generated one $k\subseteq k(f(P))$ is separably generated. We show that under these circumstances 
\begin{equation*}
\operatorname{length}_{\mathscr O_{Y,P}} (\Omega_{Y/X})_P = r(P)-1.
\end{equation*}
Denote
\begin{align*}
r &:= r(P), \\
A &:= \mathscr O_{X,f(P)}, \\
B &:= \mathscr O_{Y,P}.
\end{align*}
Thus we have inclusions $k\subseteq B\subseteq A$. Denote the maximal ideal of $A$ by ${\frak m}_A$, its residue field by $k_A$, and similarly for $B$. Thus ${\frak m}_A = (t_A)$ and ${\frak m}_B = (t_B)$ with $t_B = u t_A^r$, where $u\in A^\times$ is a unit.
By hypothesis there is a transcendence basis $\bar f_1,\dotsc, \bar f_{n-1}$ of $k_B$ over $k$ such that the extension $k_B/k(\bar f_1,\dotsc,\bar f_{n-1})$ is separable (hence has no relative differentials). Choose lifts $f_1,\dotsc, f_{n-1}\in B$ of the elements of this transcendence basis. Looking at the exact sequence
\begin{equation*}
{\frak m}_B/{\frak m}_B^2 \xrightarrow{d} \Omega_B \otimes k_B \to \Omega_{k_B} \to 0
\end{equation*}
and applying Nakayama we see that the map $B^{\oplus n} \to \Omega_B$ that sends
\begin{equation*}
e_i \mapsto
\begin{cases}
df_i & \text{if }i\le n-1\\
dt_B & \text{if }i = n
\end{cases}
\end{equation*}
is surjective. Let $K$ denote its kernel. Then $\operatorname{Tor}_1^B(\Omega_B,k_B)$ surjects onto $K\otimes_B k_B$. From the fact that $\Omega_B$ is free, it follows that $K=0$. Thus the free $B$-module $\Omega_B$ has $df_1,\dotsc, df_{n-1}, dt_B$ as a basis.
From the fact that $k_A/k_B$ is separable, it follows that $k_A/k(\bar f_1,\dotsc, \bar f_{n-1})$ is as well, so by the preceding argument the free $A$-module $\Omega_A$ has $df_1,\dotsc, df_{n-1}, dt_A$ as a basis.
The relative differentials $\Omega_{A/B}$ are thus the quotient of $\Omega_A$ by the submodule generated by $df_1,\dotsc, df_{n-1}, dt_B$. Denote by $M$ the itermediate quotient of $\Omega_A$ by $df_1,\dotsc, df_{n-1}$. Then $M$ is freely generated by the image of $dt_A$. Write
\begin{equation*}
dt_B = t_A^r du + u r t_A^{r-1} dt_A
\end{equation*}
in $\Omega_A$. In $M$ we have $du = f dt_A$ for some $f\in A$, so  $dt_B = u' t_A^{r-1}dt_A$, for some $u'\in A$. From the fact that $r\ne 0$ in $k$, it follows that $u'$ is a unit. Hence the map
\begin{equation*}
A/(t_A^{r-1}) \xrightarrow{\cdot dt_A}  \Omega_{A/B}
\end{equation*}
is an isomorphism and $\operatorname{length}_A \Omega_{A/B} = r-1$ as claimed.
