Maximal ideals of some localization of a commutative ring 
If $R$ is commutative ring, $P_1, P_2, \dots, P_n$ prime ideals of $R$ with the property $P_i \not\subseteq \bigcup _{j \not = i} P_j$, $\forall 1\le i\le n$, and $S:=R\setminus(P_1 \cup \cdots \cup P_n)$, then show: $$S^{-1}R \text{ has exactly } n \text{ maximal ideals}.$$

Definition. $S^{-1}R=${${r \over s} : r \in R , s \in S $}.
 A: Using the result mentioned by YACP in the comments, the problem reduces to proving: If an ideal $I$ contained in a union of prime ideals $P_i$, then $I$ is contained in one of the $P_i$.
We can prove that result by induction on $n$.  The case $n=1$ is clear.  For the inductive step, if $I$ is contained in a union of less than $n$ of the $P_i$, then the result holds by induction.  Otherwise, for every $i$ there exists an element $x_i \in I$ which is in $P_i$ but not in any $P_j$ for $j \ne i$.  Then the element $x = x_1 + x_2 x_3 \ldots x_n$ is in $I$, but cannot be in any of the $P$'s (why not?): contradiction.
(Do you see where we used the fact that the $P_i$ are prime?)
A: Using the prime correspondence in localizations which has already been mentioned, and Prime avoidance, we can show that the maximal ideals are exactly the $S^{-1}P_i$.
Suppose $J$ is any ideal strictly containing a $P_j$. We claim that $J\cap S\neq \emptyset$. If it were otherwise, then $J\subseteq \cup_i P_i$, and by prime avoidance, $J$ must be contained in a $P_j$. Obviously $J$ is not contained in $P_i$, so $J\subseteq \cup_{j\neq i}P_j$. But then $P_i\subset J\subseteq \cup_{j\neq i}P_j$, a contradiction. The upshot of this is that the union hypothesis forces ideals strictly containing any $P_j$ to hit $S$ and therefore explode in the localization.
You now apply this to show that each $S^{-1}P_i$ is maximal in $S^{-1}R$. If $P_i$ were not maximal, then a maximal ideal sitting above $P_i$ would contract to a prime ideal strictly containing $P_i$, but such an ideal can't be proper, as we've seen.
You now have at least $n$ maximal ideals of $S^{-1}R$. All that remains is to show there are no more.
If $M$ is maximal in $S^{-1}R$, it contracts to a prime $Q$ in $R$ such that $Q\cap S=\emptyset$. Thus $Q\subseteq \cup P_i$ and by prime avoidance $Q\subseteq P_i$ for some $i$. It follows that $S^{-1}Q=M=S^{-1}P_i$ by maximality of $M$, and we have indeed only $n$ maximal ideals.
