Let $R \hookrightarrow S$ be commutative rings. Suppose that $M$ is a finitely generated projective $S$-module. Let $f : \text{Spec}(S) \rightarrow \text{Spec}(R)$.
We have locally constant rank functions $r_R^M : \text{Spec}(R) \rightarrow \mathbb{N}$ and $r_S^M : \text{Spec}(S) \rightarrow \mathbb{N}$.
Suppose that $S$ is finitely generated and free over $R$, of rank $n$. In particular, $M$ is then finitely generated and projective over $R$.
My questions are:
(1) If $M$ is of constant rank $m$ over $S$, then is $M_R$ of constant rank $nm$ over $R$?
(2) Perhaps more generally: does $r_R^M \circ f = n \cdot r_S^M$?
There are well known relations relating these ranks when one base changes modules from $R$ to $S$, but I can't find any for restriction from $S$ to $R$.
Yes, both your questions have affirmative answers.
The key observation is that we may reduce to the case when $M$ is in fact free: for a finite projective module, there are finitely many elements $s_1,\cdots,s_a\in S$ so that $M_{s_i}$ is free over $S_{s_i}$ (e.g. Stacks 00NX). Since $\operatorname{Spec} S\to\operatorname{Spec} R$ is finite, it is closed, and therefore each $f(V(s_i))$ is closed in $\operatorname{Spec} R$. So we can cover $\operatorname{Spec} R\setminus f(V(s_i))$ by open affines which have affine preimage in $\operatorname{Spec} S$ as $f$ is finite hence affine.
Now suppose $M\cong S^{\oplus m}$ is free. Then the pushforward of $\widetilde{M}$ to $\operatorname{Spec} R$ is just $M_R\cong (S^{\oplus m})_R \cong R^{\oplus mn}$.