Hartshorne II prop 6.9
Solution 1:
If we have an injective morphism of rings $\phi:B\to A$, and we localize at a prime ideal $\mathcal{P}$ of $B$, what we're doing to $A$ is forcing the elements of $\phi(B\setminus\mathcal{P})$ to be invertible.
What does this mean for the ideals of $A$? If some ideal $I$ happens to satisfy $I \cap \phi(B\setminus\mathcal{P}) \neq \emptyset$, that means that one of its elements gets inverted, so $I$ is "localized away".
In general, the ideals of an arbitrary localization $S^{-1}A$ correspond to the ideals $I$ of $A$ with $I\cap S = \emptyset$.
So the maximal ideals we get in the localization of $A$ at the maximal ideal $\mathfrak{m} \subset B$, which Hartshorne calls $A'$, can be identified with the maximal ideals $\mathfrak{m}_i$ of $A$ with $\mathfrak{m}_i \cap (B\setminus \mathfrak{m}) = \emptyset $, i.e. $\mathfrak{m}_i \cap B \subset \mathfrak{m}$.
But $\mathfrak{m}_i \cap B$ is exactly $f (\mathfrak{m}_i)$. Since closed points map to closed points, this means that the maximal ideals of $A_{\mathfrak{m}}$ are exactly the points of $f^{-1}(\{\mathfrak{m}\})$.
As for the dimension thing, the point is that the local ring $\mathcal{O}_{P_i}$ is a DVR. We want to properly count the multiplicities of the various preimages, and the way to do that is to take a local parameter at $Q$, i.e. a generator of the maximal ideal of the local ring, and see what its multiplicity is at the various preimages. (this is actually nothing but the definition of the pullback of a divisor)
We end up with this element $t$ in the DVR $\mathcal{O}_{P_i}$, with nonzero ideals $(1) \supset (\pi) \supset (\pi^2) \supset \cdots$, and $\nu_{P_i} (t)$ is exactly the largest $n$ such that $t \in (\pi^n)$.
But we can write $t = u\pi^n$, where $u$ is a unit, so in fact $(t) = (\pi^n)$. So one way to find $n$ is just take the quotient by $t$, and see how long the chain of ideals is.
The under-the-table trick here is that each quotient $(\pi^j) / (\pi^{j+1})$, for $j\geq 0$, is a $1$-dimensional vector space over the base field $k$ (think about this; things can go wrong here if $k$ is not algebraically closed). So we can treat the chain of ideals as a filtration of a vector space, and just read off $n$ as the dimension.
See also the discussion on this question regarding this filtration, and the relationship between length and vector space dimension.
Okay, I think that I just answered your questions—or tried to; you never can tell when you're done understanding Hartshorne. Let me know if anything's unclear. (sounds like you've already got a handle on the first part, though)