As you recall, the splitting problem does not change after localization, so assume this has already occurred. Thus R is a dvr and S is a pid.
To contain is to divide, hence the primes lying over P are precisely the factors that build the extension of P. We only need find the exponents.
Let Qi be one of the prime ideals lying over P. Mod out by Qi upstairs and P downstairs, and the embedding of R in S becomes an embedding of the field F = R/P into the field S/Qi. Let di be the dimension of this field extension. This is called the residual degree, or the residue degree, of Qi.
Note that the residue degree can be computed before or after localization, since the two quotient rings are the same.
Let P*S be the product of Qi raised to the ei. Thus ei is the exponent, yet to be determined. By definition, ei is the ramification degree of Qi.
Since S is a free R module of rank n, S×F becomes an n dimensional F vector space. Thus S/(P*S) = Fn.
At the same time, S mod Qi is an F vector space of dimension di. What is the connection between di and n?
Tensor the ideal Qij with S/Qi and get Qij mod Qij+1. Since S is a pid, Qij is principal, and looks just like a free S module. Therefore the quotient module looks like S/Qi, an F vector space of dimension di.
Consider the quotient ring S mod Qij+1. This includes the ideal Qij mod Qij+1. We just showed this ideal is an F vector space of dimension di. By induction, the quotient ring, which is really S/Qij, is an F vector space of dimension j×di. Combine kernel and quotient and find a vector space of dimension (j+1)×di. Therefore, S mod Qi to the ei becomes an F vector space of dimension ei×di.
Apply the chinese remainder theorem and write S mod P*S as the direct product of all these quotient rings. This becomes the direct product of vector spaces, which adds their dimensions. Therefore n = the sum of ei×di.
In summary, the dimension of the extension is the sum, over the primes lying over P, of the ramification degreee times the residue degree.
If the ramification degree of each prime is 1, P is unramified. The sum of the residue degrees equals n.
If there are n primes lying over P, each ramification degree and each residue degree is 1. Thus P is unramified.
Extend P into S via P*S, then extend this into S′ via (P*S)*S′. This is the same as P*S′. In other words, the extension of the extension is the composite extension.
Similarly, the primes in S′ lying over P are precisely the primes of S′ that lie over the primes of S, that lie over P.
Fix a prime Q over P, and a prime Q′ over Q. The residue fields form a tower of field extensions, and dimensions multiply as usual. Therefore the residue degree of Q′ over P is the residue degree of Q′ over Q times the residue degree of Q over P.
A similar result holds for ramification degrees. Since product and extension commute, write P as a product of various powers of Qi, and push this up to S′. Replace each Qi*S′ with its factorization in S′ to find the factorization of P in S′. For a given Q′ over P, its ramification degree is the product of the ramification degree of Q′ over Q times the ramification degree of Q over P.
If an automorphism carries one prime ideal onto another, mod out by both prime ideals and find an isomorphism between the residue fields. These residue fields establish the residue degree. Again, G acts transitively on prime ideals, Hence the residue degree is constant across the primes over P.
The degree equation has been simplified. The dimension of the extension is the ramification degree times the residue degree times the number of primes lying over P.
If the dimension is prime, P is totally ramified or unramified.