Maps to $\mathbb{P}^1$ induced by rational functions. I am reading from Hartshorne, Corollary II.6.10 page 138. 
Given a nonsingular (is this necessary?) curve $X$ over a field $k$, let $f\in K(X)^*\setminus k$. Then the inclusion of fields $k(f)\subseteq K(X)$ (finite field extension) induces a finite morphism $\phi:X\to \mathbb{P}^1$.
Question 1: why? For example, how is $\phi$ defined scheme-theoretically? Because Hartshorne cites what he did in Chapter I using valuations, but to me it is really unsatisfying to have to follow 100 equivalences of categories just to understand this construction (in fact I have been trying to do that many times, but always failed).
Now it is stated that $(f)=\phi^*(0-\infty)$. 
Question 2: this is supposed to be obvious, but to me is not (maybe an answer to question 1 will settle this immediatly).
Also does $k$ have to be algebraically closed? I don't think so, but in chapter I it is always assumed.
 A: Let me know if this is convincing to you. Let $Z$ be the set of zeros of $f$ and $P$ be the set of poles.
We have a map $X\backslash P\rightarrow \mathbb{A}^1$ that is defined by $k[x]\rightarrow \Gamma(X\backslash P,\mathscr{O}_X)$ where $x$ is sent to $f$. 
Similarly, we have a map $X\backslash Z\rightarrow \mathbb{A}^1$ that is defined by $k[y]\rightarrow \Gamma(X\backslash Z,\mathscr{O}_X)$ where $y$ is sent to $\frac{1}{f}$. 
These two maps glue together to a map $X\rightarrow \mathbb{P}^1$. From this construction, the statement that $(f)=\phi^{*}((0)-(\infty))$ can be deduced. 
A: Let me try to elaborate what Qiaochu said. Write $f = f_{0}/f_{1}$, and by throwing away common zeros if necessary, we may assume that $f_{0}, f_{1} \in A = \Gamma(\text{Spec}(A), \mathscr{O}_{X})$ do not have common zeros, where $\text{Spec}(A) \subset X$ is some affine  open. Consider $A_{f_{0}} \rightarrow k[x_{1}/x_{0}]$ given by $f_{1}/f_{0} \mapsto x_{1}/x_{0}$ and $A_{f_{1}} \rightarrow k[x_{0}/x_{1}]$ given by $f_{0}/f_{1} \mapsto x_{0}/x_{1}$. These ring maps glue on the intersection of the corresponding scheme maps, so we get $\text{Spec}(A) = D_{A}(f_{0}) \cup D_{A}(f_{1}) \rightarrow \mathbb{P}^{1}_{k}$. Note that the equality uses that $f_{0}$ and $f_{1}$ do not have any common zeros. You can now extend this map to $C$, but I do not know where Hartshorne does it because I have not studied this with his book. Alternatively, you can look at Theorem 16.5.1 of  Ravi Vakil's notes. I think this extension is where you need that $C$ is one-dimensional.
A: Let $X$ be a complete nonsingular curve; see Definition at page 136 in Hartshorne. Let $f \in K(X)$ be a rational function.
Proposition 1. The rational function $f$ induces a morphism $\varphi: X \rightarrow \mathbb{P}^1$.
Proof. We will show that $f$ induces a morphism $ \operatorname{Spec} A \rightarrow \mathbb{P}^1$ for any affine open $\operatorname{Spec} A$ of $X$. It follows from their construction, that these morphisms easily glue to give the required morphism $X \rightarrow \mathbb{P}^1$.
Fix $\operatorname{Spec} A$ an affine open of $X$. We can write $f = a_0/a_1$, with $a_0 \in A, a_1 \in A^*$. The set of zeros of $f$ in $\operatorname{Spec} A$ is the closed subscheme $\mathbb{V}(a_0)$ while the set of poles is $\mathbb{V}(a_1)$.
Define a $k$-algebra homomorphism $k[x_{0/1}] \rightarrow A_{a_1}$ given by $x_{0/1} \mapsto a_0/a_1$. This gives a morphism $D(a_1) \rightarrow \mathbb{P}^1$. Similarly, the $k$-algebra homomorphism $k[x_{1/0}] \rightarrow A_{a_0}$ given by $x_{1/0} \mapsto a_1/a_0$ gives a morphism $D(a_0) \rightarrow \mathbb{P}^1$. These two morphisms glue to a morphism $D(a_0) \cup D(a_1) \rightarrow \mathbb{P}^1$.
Let $Y = \operatorname{Spec} A \setminus D(a_0) \cup D(a_1)$ be the closed subscheme of $\operatorname{Spec} A$ consisting of the finitely many simultaneous zeros and poles of $f$ in $\operatorname{Spec} A$. If $Y$ is empty we are done, so suppose otherwise. We proceed in two alternative ways.
Approach 1. Take any $y \in Y$. Let $\operatorname{Spec} B$ be a neighborhood of $y$ in $\operatorname{Spec} A$ such that $\operatorname{Spec} B \cap Y = \{y\}$; such a neighborhood exists because $Y$ is a finite set of points. The inclusion of opens $\operatorname{Spec} B \subset \operatorname{Spec} A$ is given by a ring homomorphism $A \rightarrow B$ (in fact this is an inclusion of rings). Let $b_0,b_1$ be the images of $a_0,a_1$ under $A \rightarrow B$. Moreover, we identify $y$ with the prime ideal $P$ of $B$. By construction, it is the only prime ideal of $B$ that contains both $a_0$ and $a_1$. Since $X$ is a nonsingular curve, $B_P = \mathscr{O}_{X,P}$ is a discrete valuation ring. Let $u$ be the uniformizing parameter of $B_P$. By shrinking $\operatorname{Spec} B$ even further, if necessary, we may assume that $P$ is a principal ideal generated by $u$. Thus $b_0=c_0 u^{n_0}$ and $b_1=c_1 u^{n_1}$, where $c_0$ and $c_1$ are not in $P$. Without loss of generality suppose that $n_0 \ge n_1$ and finally, replace $B$ by $B_{c_1}$.
We have a morphism $D(b_1) \rightarrow \mathbb{P}^1$ given by the $k$-algebra homomorphism $k[x_{0/1}] \rightarrow B_{b_1}$, corresponding to $x_{0/1} \mapsto b_0/b_1$. Here is the crucial fact: $b_0 / b_1 = c_0 c_1^{-1} u^{n_0-n_1} \in B$. Hence $k[x_{0/1}] \rightarrow B_{b_1}$ factors through the inclusion $B \subset B_{b_1}$. This gives a morphism $\operatorname{Spec} B \rightarrow \mathbb{P}^1$ that extends $D(b_1) \rightarrow \mathbb{P}^1$. We can now glue the morphisms $D(a_0) \cup D(a_1) \rightarrow \mathbb{P}^1$ and $\operatorname{Spec} B \rightarrow \mathbb{P}^1$ along the open set $\operatorname{Spec} B \setminus \{y\}$ to obtain a morphism $D(a_0) \cup D(a_1) \cup \{y\} \rightarrow \mathbb{P}^1$. Repeating this process for the remaining, finitely many, points of $Y$, we obtain a morphism $\operatorname{Spec} A \rightarrow \mathbb{P}^1$ that extends $D(a_0) \cup D(a_1) \rightarrow \mathbb{P}^1$. QED
Approach 2. The closed subscheme $Y$ is defined by the ideal $I=(a_0,a_1)$. Let $\mathscr{J}$ be the ideal sheaf of $\operatorname{Spec}A$ defined by $I$. Since every local ring of $A$ is a discrete valuation ring, $\mathscr{J}$ is an invertible sheaf of ideals. Its global sections $a_0,a_1$ define a rational map $\operatorname{Spec}A \dashrightarrow \mathbb{P}^1$ with indeterminancy locus $Y$. Let $\pi:\tilde{
X} \rightarrow \operatorname{Spec}A$ be the blow-up of $\operatorname{Spec}A$ along $Y$. Then by
Example II.7.17.3 in Hartshorne, there is a morphism $\tilde{X} \rightarrow \mathbb{P}^1$ that extends $\operatorname{Spec}A \dashrightarrow \mathbb{P}^1$. But, since $\mathscr{J}$ is an invertible ideal sheaf, the universal property of the blow-up gives $\tilde{X} = \operatorname{Spec}A$. QED
Finally,
Proposition 2. Let $\varphi: X \rightarrow \mathbb{P}^1$ be the morphism of Proposition 1. Then $\varphi^*(\{0\}-\{\infty\}) = (f)$.
Proof. We apply the definition of the pullback of divisors on nonsingular curves given by Hartshorne on page 137. The divisor $\{0\}$ is the point $[0:1]$ of $\mathbb{P}^1$, or equivalently, the closed subscheme of $\mathbb{P}^1 = \operatorname{Proj} k[x_0,x_1]$ given by the ideal $(x_0)$. Similarly, $\{\infty\}$ corresponds to the ideal $(x_1)$. By linearity, we have $\varphi^*(\{0\}-\{\infty\}) = \varphi^*(\{0\}) - \varphi^*(\{\infty\})$. By definition, and thinking how $\varphi$ was constructed locally (e.g., see Approach 1 above), we have that $\varphi^*(\{0\}) = \sum_{P \in X: \, f \in \mathscr{O}_{X,P}}  v_P(f) \cdot P$. Similarly, $\varphi^*(\{\infty\}) = \sum_{P \in X: \, 1/f \in \mathscr{O}_{X,P}}  v_P(f) \cdot P$. Put together, $\varphi^*(\{0\}-\{\infty\}) = \sum_{P \in X: \, f \in \mathscr{O}_{X,P}}  v_P(f) \cdot P- \sum_{P \in X: \, 1/f \in \mathscr{O}_{X,P}}  v_P(f) \cdot P = \sum_{P \in X}  v_P(f) \cdot P = (f)$. QED
