Pull-back line bundle under morphism of degree $d$ This question is partially related to Direct image of vector bundle
Let $f:\mathbb{P}^1\to\mathbb{P}^1$ be a morphism of degree $d$. For $n>0$, how can we compute $f^*\mathcal{O}_{\mathbb{P}^1}(n)$?
I tried the following way.
Let $\mathcal{L}=f^*\mathcal{O}_{\mathbb{P}^1}(n)$. We have $\text{h}^0(\mathcal{L})=\text{h}^0(f_*\mathcal{L})$ and by the projection formula $f_*\mathcal{L}\cong\mathcal{O}_{\mathbb{P}^1}(n)\otimes f_*\mathcal{O}_{\mathbb{P}^1}$.
Suppose that we have $f_*\mathcal{O}_{\mathbb{P}^1}\cong\mathcal{O}_{\mathbb{P}^1}\oplus\mathcal{O}_{\mathbb{P}^1}(-1)^{\oplus(d-1)}$  $(*)$
Then $f_*\mathcal{L}\cong\mathcal{O}_{\mathbb{P}^1}(n)\oplus\mathcal{O}_{\mathbb{P}^1}(n-1)^{\oplus(d-1)}$ and $\text{h}^0(f_*\mathcal{L})=dn+1$. Therefore $\mathcal{L}\cong\mathcal{O}_{\mathbb{P}^1}(dn)$.
Here are my questions:


*

*Why is $(*)$ true?

*How to compute $f^*\mathcal{O}_{\mathbb{P}^1}(n)$ in a more direct way?
 A: Here's a fact which is nice. Let $f:C\to C'$ be a finite map of curves (smooth, projective, geometrically integral). Then, we have an obvious map 
$$f^\ast:\mathrm{Pic}(C')\to\mathrm{Pic}(C)$$
given by the usual pull-back of line bundles. But, similarly to as Asal Beag Dubh commented, we also have a very natural map 
$$f^\ast:\mathrm{Div}(C')\to \mathrm{Div}(C)$$
This is linear extension of the map taking a prime divisor $D$ to the following:
$$\mathrm{Div}(C')\ni D\mapsto D\times_{C'}C\in\mathrm{Div}(C)$$
In words, $D$ is a closed subscheme of $C'$. You can pull-this back to a closed subscheme of $C$, this map just being the literal fiber product. 
That said, I am sweeping something under the rug a bit. Namely, $\mathrm{Div}(C)$ is not the set of closed subschemes of $C$, it's the free-abelian group on the irreducible codimension $1$ closed subschemes of $C$ (let's assume we're over $k=\bar{k}$ for simplicity). So, to make the above rigorous, I need to tell you how to go from a closed subscheme $Z$ of $C$ to an element $\mathrm{Div}(C)$. What you do is as follows. 
For each $p\in C$, consider $Z\times_C p$--pullback the closed subscheme to the point. Since $Z\times_C p\to p$ is finite type, and $Z\times_C p$ is discrete (why?), we know that $Z\times_C p$ is just $n_p(Z)$-points (we're using $k=\bar{k}$ here, do you see where?). Then, the element of $\mathrm{Div}(C)$ I am associating to $Z$ is 
$$Z\mapsto \sum_{p\in |C|}n_p(Z)Z$$
where $|C|$ denotes the closed points (equivalently the $k$-points) of $C$.
Thus, you see that we do have a well-defined map 
$$f^\ast:\mathrm{Div}(C')\to\mathrm{Div}(C):D\leadsto Z:=D\times_{C'}C\leadsto \sum_{p\in |C|}n_p(Z)p$$
which, definitionally, factors through the set of closed subschemes of $C$.
This map has the following excellent property:
$$f^\ast\mathcal{O}(D)=\mathcal{O}(f^\ast D)$$
This is nice, but it doesn't seem useful unless one can explicitly compute $f^\ast D$. That said, I leave it for you to check the following:


*

*$f^\ast$ is linear (definitionally)

*The following equation holds $$f^\ast(q)=\sum_{p\in f^{-1}(q)}e_p p$$


From 2., we then get a nice interpretation of $e_p$. Namely, as you can show, $n_p(Z)=e_p$. This is since $f$ having $e_p$ sheets come together at $p$ tricks $f$ into thinking that there are $n_p(Z)=e_p$ many points in $f^{-1}(q)$ at $p$.
In particular, note the following. If $\displaystyle D=\sum_q n_q(Z) q$ then
$$\begin{aligned}\deg f^\ast\mathcal{O}(D) &=\deg \mathcal{O}(f^\ast D)\\ &=\deg f^\ast D\\ &= \deg\left(\sum_q n_q\sum_{p\in f^{-1}(q)}e_p p\right)\\ &= \sum_q n_q\sum_{p\in f^{-1}(q)}e_p\\ &= \sum_q n_q(\deg f)\\ &= \deg(f)\sum_q n_q\\ &=(\deg f)(\deg D)\end{aligned}$$

For example, let's take your degree $n$ map $f:\mathbb{P}^1\to \mathbb{P}^1$. Then, $\mathcal{O}(n)=\mathcal{O}(n\infty)$, and so explicitly
$$f^\ast \mathcal{O}(n)=\mathcal{O}(f^\ast(n\infty))=\mathcal{O}\left(n\sum_{p\in f^{-1}(\infty)}e_p p\right)$$
but, since all points on $\mathbb{P}^1$ are equivalent, you get that we can replace all the $p$ with any point, let's say $\infty$, so the above becomes
$$f^\ast\mathcal{O}(n)=\mathcal{O}\left(n\sum_{p\in f^{-1}(\infty)}e_p \infty\right)=\mathcal{O}(n(\deg f)\infty)$$
Or, using more common notation, 
$$f^\ast\mathcal{O}(n)=\mathcal{O}((\deg f)n)$$
as expected.
Of course, you could proceed as Asal Beag Dubh did, and note that, as computed above, $\deg f^\ast\mathcal{O}(n)$ is $(\deg f)\left(\deg \mathcal{O}(n)\right)=n(\deg f)$, and there is only one line bundle on $\mathbb{P}^1$ with that degree: $\mathcal{O}(n)$.

The above is part of a much more general story when one things about intersection theory on varieties. The above is a special instance of 'flat pullback'.
I'd like to also note that what I wrote above isn't something you probably haven't seen before. The above is contained in, for example, Hartshorne, just without the explanation of why 
$$f^\ast(q)=\sum_{p\in f^{-1}(q)}e_p p$$
makes sense.
Let me know if you need more geometric intuition! I can draw a picture.
EDIT: I didn't answer your entire question. You also wanted to compute $f_\ast\mathcal{O}_X$ (I'm going to let $X=\mathbb{P}^1$). So, we can do a trick similar to the answer in the post you linked to. Namely, since $f$ has degree $d$ we know that $f_\ast\mathcal{O}_X$ is a vector bundle of rank $d$. Thus, by Grothendieck's theorem, we have that 
$$f_\ast\mathcal{O}_X=\mathcal{O}(m_1)\oplus\cdots\oplus\mathcal{O}(m_d)$$
Now, since $(f_\ast\mathcal{O}_X)(X)=k$, we can easily see that without loss of generality $m_1=0$, and $m_2,\ldots,m_d<0$. But, we also know that 
$$H^1(X,\mathcal{O}_X\oplus\mathcal{O}(m_2)\oplus\cdots\oplus\mathcal{O}(m_d))=H^1(X,\mathcal{O}_X)=0$$
But, then, by inspecting the chart for the cohomology of vector bundle this computation, along with the fact that $m_2,\ldots,m_d<0$, implies that $m_2=\cdots=m_d=-1$. This was the desired result.
