Why (Arakelov) intersection number well-defined I am recently looking at Serge Lang's Introduction to Arakelov Theory, at the beginning of Chapter IV, the set up is:
Let $F$ be a number field and R its ring of integers. $v$ a finite absolute value of $F$. Let $\pi: X \to \text{Spec}R$ be a proper flat morphism of relative dimension $1$ with $X$ regular, irreducible and integral (so that $X$ is an arithmetic surface).
Suppose $D,E$ are two effective Cartier divisors on $X$ represented by $f,g$ in the local ring $O_{x}$ with $x \in X$. Suppose $k(x)$ is a finite extension of $k(v)$, then the intersection number is
$$\text{(1)}\ \ \ i_{x}(D,E)=\text{length of } O_{x}/(f,g)$$
and define
$$\text{(2)}\ \ \ (D.E)_{x}=i_{x}(D,E)\log|k(x)|=\log(O_{x}:(f,g)).$$
Then let 
$$\text{(3)}\ \ \ (D.E)_{v}=\sum_{x|v}(D.E)_{x}.$$
I know that in standard algebraic geometry, the intersection number is the same as $i_{x}(D,E)$ (as in Hartshorne Chap I Exercise 5.4). So why here we would like to introduce (2) by multiplying its residue field? Also, I can't see the last equality of (2), can someone explain?
Last, for (3), why it is a finite sum so that it is well-defined?
Any comment/hint/reference is appreciated! Thank you!
 A: Multiplying by $\log|k(x)|$ gives us information about the degree of the intersection points - this is the same sort of adjustment we need to make to Bezout's theorem over fields which aren't algebraically closed. There might be more motivation to multiply by $\log |k(x)|=\deg(x)\log|k(v)|$ instead of just $\deg(x)$, but this is one big reason.
To establish the equality $i_x(D,E)\log|k(x)| = \operatorname{len}(\mathcal{O}_x/(f,g))\log|k(x)| = \log(\mathcal{O}_x:(f,g))$, recall that we can compute the length of $\mathcal{O}_x/(f,g)$ by choosing a composition series $0\subset N_1\subset\cdots \subset N_n=\mathcal{O}_x/(f,g)$ for this module as a $\mathcal{O}_x$-module. Such a composition series has the successive quotients $N_i/N_{i-1}$ isomorphic to simple modules over $\mathcal{O}_x$, but the only such simple module is $\mathcal{O}_x/\mathfrak{m}_x=k(x)$. So we know that $|\mathcal{O}_x/(f,g)|=|k(x)|^{\operatorname{len}(\mathcal{O}_x/(f,g)}$, which is exactly the same as the index of $(f,g)\subset \mathcal{O}_x$. Taking logs, we see the result.
Finally, in order to see that the final sum over $x|v$ is finite, we should understand what it means for $x|v$. This means that $v$ is a non-$R$-rational point with degree $>1$. The possible $x$ are then the possible ways to split $v$ in field extensions - the number of ways to do this corresponds to the galois-invariant subsets of the geometric points over $v$. But the number of geometric points over $v$ is exactly the same as it's degree, which is finite. So the number of possible $x|v$ is again finite.
