Apply a rather technical theorem, and U×V equals the fraction ring of R, using all the denominators present in U and V. By equals we mean isomorphic, but the isomorphism is natural. Map the tensor product onto the fractions of U cross V, then combine the two fraction rings into one using the isomorphism described in the aforementioned theorem. It looks really complicated, but it's not. One fourth of one seventh is just like 1/28, and that's really all we're saying.
Since tensor product is associative, M×U×V = M×(UV). (again, equals means isomorphic.) Therefore, applying two successive fraction rings is equivalent to applying a third fraction ring whose denominators are drawn from the first two.
If Q is a maximal ideal, the rank of MQ is the same as the rank of MP for all the primes P in Q. Furthermore, if the intersection of two maximal ideals contains a prime ideal, then all the primes in both maximal ideals lead to the same local rank.
If the nil radical is prime, such as an integral domain, M has constant local rank.
Assume M does not have constant rank. Let A be the set of primes P for which MP has rank n, and let B contain all other primes. Let A1 be the intersection of the primes in A, and similarly for B1. Let S be the complement of a minimal prime in A. Thus S is a maximal multiplicative set in R. Naturally S misses A1.
Let P be any prime containing A1. This includes all the primes of A. If S does not contain R-P, it can be crossmultiplied by R-P to give a larger multiplicative set. Thus S contains R-P, and M/S has rank n. Therefore P is in A after all. No prime ideal in B contains A1, and similarly no prime ideal in A contains B1.
The two ideals A1 and B1 define closed sets in the zariski topology of R. Together these closed sets partition spec R. Thus both sets are open and closed, and are disjoint components of spec R. Turning this around, the primes in a connected component of spec R all exhibit the same local rank.
Find a clopen subspace of spec R with local rank 0. (This subspace could be empty.) Then find a clopen subspace with rank 1, then rank 2, and so on. Thus spec R has been partitioned into a countable number of disconnected subspaces, each with constant local rank. Note that a subspace could contain several connected components, but each component belongs entirely to a subspace of a given rank.
Assume R is a reduced ring, with nil(R) = 0. If two different ranks imply two disjoint spaces in spec R, one can produce a idempotent for each space. If R/nil(R) contains no nontrivial idempotents then every projective module over R has constant local rank.