[proofplan]
We use the fraction-field definition of rank. Choose an $R$-module isomorphism $M \cong R^n$, extend scalars from $R$ to $K$, and identify the resulting $K$-vector space with $K^n$. The standard basis of $K^n$ then has exactly $n$ elements, so the $K$-dimension is $n$.
[/proofplan]
[step:Extend the specified module isomorphism from $R$ to $K$]
Let
\begin{align*}
\varphi: M \to R^n
\end{align*}
be the $R$-module isomorphism specified in the theorem statement. Define
\begin{align*}
b_\varphi: K \times M \to K \otimes_R R^n
\end{align*}
by
\begin{align*}
b_\varphi(a,m)=a \otimes \varphi(m),
\end{align*}
where $a \in K$ and $m \in M$. The map $b_\varphi$ is additive in both variables. If $r \in R$, then the balancing relation in $K \otimes_R R^n$ and the $R$-linearity of $\varphi$ give
\begin{align*}
b_\varphi(a\iota(r),m)=a\iota(r) \otimes \varphi(m)=a \otimes r\varphi(m)=a \otimes \varphi(rm)=b_\varphi(a,rm).
\end{align*}
Hence $b_\varphi$ is $R$-balanced. By the defining universal property of the tensor product $K \otimes_R M$, there is a unique additive map
\begin{align*}
\Phi: K \otimes_R M \to K \otimes_R R^n
\end{align*}
satisfying
\begin{align*}
\Phi(a \otimes m)=a \otimes \varphi(m)
\end{align*}
for all $a \in K$ and $m \in M$. Because multiplication in the first tensor factor defines the $K$-vector space structures, this map is $K$-linear.
Since $\varphi$ is an isomorphism, it has an $R$-linear inverse
\begin{align*}
\varphi^{-1}: R^n \to M.
\end{align*}
Applying the same defining universal property of the tensor product to the $R$-linear map $\varphi^{-1}$ gives an additive map, and the same first-factor scalar computation shows that it is a $K$-linear map
\begin{align*}
\Psi: K \otimes_R R^n \to K \otimes_R M
\end{align*}
defined on pure tensors by
\begin{align*}
\Psi(a \otimes v) = a \otimes \varphi^{-1}(v),
\end{align*}
where $a \in K$ and $v \in R^n$. On pure tensors,
\begin{align*}
(\Psi \circ \Phi)(a \otimes m) = a \otimes \varphi^{-1}(\varphi(m)) = a \otimes m
\end{align*}
and
\begin{align*}
(\Phi \circ \Psi)(a \otimes v) = a \otimes \varphi(\varphi^{-1}(v)) = a \otimes v.
\end{align*}
Pure tensors generate the tensor product as an abelian group, so $\Psi \circ \Phi = \operatorname{id}_{K \otimes_R M}$ and $\Phi \circ \Psi = \operatorname{id}_{K \otimes_R R^n}$. Hence
\begin{align*}
K \otimes_R M \cong K \otimes_R R^n
\end{align*}
as $K$-vector spaces.
[/step]
[step:Identify the scalar extension of $R^n$ with $K^n$]
For each $i \in \{1, \dots, n\}$, let $e_i \in R^n$ denote the vector whose $i$th coordinate is $1_R$ and whose other coordinates are $0_R$. Define
\begin{align*}
g: K \times R^n \to K^n
\end{align*}
by
\begin{align*}
g(a,(r_1, \dots, r_n))=(a r_1, \dots, a r_n),
\end{align*}
where $a \in K$ and $r_1, \dots, r_n \in R$, with each product computed in $K$ after applying $\iota$ to the relevant element of $R$. The map $g$ is additive in both variables by distributivity in $K$. If $r \in R$ and $v=(r_1,\dots,r_n) \in R^n$, then
\begin{align*}
g(a\iota(r),v)=(a\iota(r)\iota(r_1),\dots,a\iota(r)\iota(r_n))=g(a,rv),
\end{align*}
so $g$ is $R$-balanced. By the defining universal property of the tensor product $K \otimes_R R^n$, there is a unique additive map
\begin{align*}
\alpha: K \otimes_R R^n \to K^n
\end{align*}
such that
\begin{align*}
\alpha(a \otimes (r_1, \dots, r_n)) = (a\iota(r_1), \dots, a\iota(r_n))
\end{align*}
for all $a \in K$ and $r_1,\dots,r_n \in R$. For $c \in K$, the scalar multiplication on $K \otimes_R R^n$ is defined on pure tensors by $c(a \otimes v)=(ca)\otimes v$, and the displayed formula gives $\alpha(c(a \otimes v))=c\alpha(a \otimes v)$ for every $a \in K$ and $v \in R^n$. Since pure tensors generate $K \otimes_R R^n$ as an abelian group, $\alpha$ is $K$-linear.
Define a map
\begin{align*}
\beta: K^n \to K \otimes_R R^n
\end{align*}
by
\begin{align*}
\beta(a_1, \dots, a_n) = \sum_{i=1}^n a_i \otimes e_i.
\end{align*}
This map is $K$-linear: for $c \in K$ and $(a_1, \dots, a_n),(b_1, \dots, b_n) \in K^n$, additivity of the tensor product in the first variable gives
\begin{align*}
\beta((a_1, \dots, a_n)+(b_1, \dots, b_n)) = \beta(a_1, \dots, a_n)+\beta(b_1, \dots, b_n)
\end{align*}
and the first-factor scalar multiplication on $K \otimes_R R^n$ gives
\begin{align*}
\beta(c(a_1, \dots, a_n)) = c\beta(a_1, \dots, a_n).
\end{align*}
For $(a_1, \dots, a_n) \in K^n$,
\begin{align*}
(\alpha \circ \beta)(a_1, \dots, a_n) = \sum_{i=1}^n \alpha(a_i \otimes e_i) = (a_1, \dots, a_n).
\end{align*}
For a pure tensor $a \otimes (r_1, \dots, r_n) \in K \otimes_R R^n$, the decomposition
\begin{align*}
(r_1, \dots, r_n) = \sum_{i=1}^n r_i e_i
\end{align*}
in $R^n$ gives
\begin{align*}
a \otimes (r_1, \dots, r_n) = \sum_{i=1}^n a \otimes r_i e_i = \sum_{i=1}^n a r_i \otimes e_i.
\end{align*}
Therefore
\begin{align*}
(\beta \circ \alpha)(a \otimes (r_1, \dots, r_n)) = \sum_{i=1}^n a\iota(r_i) \otimes e_i = a \otimes (r_1, \dots, r_n).
\end{align*}
Since pure tensors generate $K \otimes_R R^n$, we have $\beta \circ \alpha = \operatorname{id}_{K \otimes_R R^n}$. Thus
\begin{align*}
K \otimes_R R^n \cong K^n
\end{align*}
as $K$-vector spaces.
[guided]
The goal of this step is to make the scalar extension $K \otimes_R R^n$ completely explicit. The vectors $e_1, \dots, e_n \in R^n$ are the standard basis vectors, where $e_i$ has $1_R$ in the $i$th coordinate and $0_R$ elsewhere.
Define
\begin{align*}
g: K \times R^n \to K^n
\end{align*}
by
\begin{align*}
g(a,(r_1, \dots, r_n))=(a r_1, \dots, a r_n).
\end{align*}
This formula uses the homomorphism $\iota: R \to K$ to view each $r_i \in R$ as an element $\iota(r_i)$ of the field $K$. To pass from a formula on pairs to a map on the tensor product, we must verify the balancing relation. The map $g$ is additive in both variables by distributivity in $K$. If $r \in R$ and $v=(r_1,\dots,r_n) \in R^n$, then
\begin{align*}
g(a\iota(r),v)=(a\iota(r)\iota(r_1),\dots,a\iota(r)\iota(r_n))=g(a,rv).
\end{align*}
Thus $g$ is $R$-balanced. By the defining universal property of the tensor product $K \otimes_R R^n$, there is a unique additive map
\begin{align*}
\alpha: K \otimes_R R^n \to K^n
\end{align*}
satisfying
\begin{align*}
\alpha(a \otimes (r_1, \dots, r_n))=(a\iota(r_1), \dots, a\iota(r_n))
\end{align*}
for all $a \in K$ and $r_1,\dots,r_n \in R$. We also need $\alpha$ to be $K$-linear. If $c \in K$, $a \in K$, and $v \in R^n$, then scalar multiplication on $K \otimes_R R^n$ gives $c(a \otimes v)=(ca)\otimes v$. Applying the formula defining $\alpha$ gives $\alpha(c(a \otimes v))=c\alpha(a \otimes v)$. Since pure tensors generate $K \otimes_R R^n$ as an abelian group, this proves that $\alpha$ is $K$-linear.
Now define the candidate inverse
\begin{align*}
\beta: K^n \to K \otimes_R R^n
\end{align*}
by
\begin{align*}
\beta(a_1, \dots, a_n) = \sum_{i=1}^n a_i \otimes e_i.
\end{align*}
This map reconstructs a tensor from its $n$ scalar coordinates. It is $K$-linear because the tensor product is additive in the first variable and because scalar multiplication on $K \otimes_R R^n$ is defined on the first tensor factor: for $c \in K$ and $(a_1, \dots, a_n),(b_1, \dots, b_n) \in K^n$,
\begin{align*}
\beta((a_1, \dots, a_n)+(b_1, \dots, b_n)) = \beta(a_1, \dots, a_n)+\beta(b_1, \dots, b_n)
\end{align*}
and
\begin{align*}
\beta(c(a_1, \dots, a_n)) = c\beta(a_1, \dots, a_n).
\end{align*}
We check the two compositions. First, for $(a_1, \dots, a_n) \in K^n$,
\begin{align*}
(\alpha \circ \beta)(a_1, \dots, a_n) = \alpha\left(\sum_{i=1}^n a_i \otimes e_i\right).
\end{align*}
By $K$-linearity of $\alpha$, this equals
\begin{align*}
\sum_{i=1}^n \alpha(a_i \otimes e_i) = (a_1, \dots, a_n).
\end{align*}
Thus $\alpha \circ \beta = \operatorname{id}_{K^n}$.
Conversely, take a pure tensor $a \otimes (r_1, \dots, r_n) \in K \otimes_R R^n$. In $R^n$ we have the standard basis decomposition
\begin{align*}
(r_1, \dots, r_n) = \sum_{i=1}^n r_i e_i.
\end{align*}
Using additivity of the tensor product in the second variable and the balancing relation $a \otimes r_i e_i = a\iota(r_i) \otimes e_i$, we get
\begin{align*}
a \otimes (r_1, \dots, r_n) = \sum_{i=1}^n a \otimes r_i e_i = \sum_{i=1}^n a\iota(r_i) \otimes e_i.
\end{align*}
Therefore
\begin{align*}
(\beta \circ \alpha)(a \otimes (r_1, \dots, r_n)) = \beta(a\iota(r_1), \dots, a\iota(r_n)) = \sum_{i=1}^n a\iota(r_i) \otimes e_i.
\end{align*}
The previous computation shows that this is exactly $a \otimes (r_1, \dots, r_n)$. Since every element of $K \otimes_R R^n$ is a finite sum of pure tensors, the equality holds on all of $K \otimes_R R^n$. Hence $\alpha$ and $\beta$ are inverse $K$-linear isomorphisms, so
\begin{align*}
K \otimes_R R^n \cong K^n.
\end{align*}
[/guided]
[/step]
[step:Compute the rank from the dimension of the scalar extension]
By definition of rank over the integral domain $R$,
\begin{align*}
\operatorname{rank}_R M = \dim_K(K \otimes_R M).
\end{align*}
From the previous two steps,
\begin{align*}
K \otimes_R M \cong K \otimes_R R^n \cong K^n
\end{align*}
as $K$-vector spaces. Therefore
\begin{align*}
\operatorname{rank}_R M = \dim_K(K^n).
\end{align*}
For each $i \in \{1,\dots,n\}$, let $f_i \in K^n$ be the vector whose $i$th coordinate is $1_K$ and whose other coordinates are $0_K$. The vectors $f_1, \dots, f_n$ form the standard basis of the $K$-vector space $K^n$, so
\begin{align*}
\dim_K(K^n) = n.
\end{align*}
Thus
\begin{align*}
\operatorname{rank}_R M = n.
\end{align*}
This proves the theorem.
[/step]