THEOREM 1. Let $E$ be a field, let $F$ be a subfield, and let $A$ and $B$ be $n$ by $n$ matrices with coefficients in $F$. If $A$ and $B$ are similar over $E$, they are similar over $F$.
This is an immediate consequence of
THEOREM 2. In the above setting, let $X$ be an indeterminate, and let $g_k(A)\in F[X]$, $1\le k\le n$, be the monic gcd of the determinants of all the $k$ by $k$ submatrices of $X-A$. Then $A$ and $B$ are similar over $F$ if and only if $g_k(A)=g_k(B)$ for all $k$.
References:
Basic Algebra I: Second Edition, Jacobson, N., Section 3.10.
A Survey of Modern Algebra, Birkhoff, G. and Lane, S.M., 2008. In the 1999 edition it was in Section X1.8, titled
"The Calculation of Invariant Factors".
Algèbre: Chapitres 4 à 7, Nicolas Bourbaki. Translation: Algebra II.
(I haven't found online references.)
Here is the sketch of a proof of Theorem 2.
EDIT [This edit follows Soarer's interesting comment.] Each of the formulas $fv:=f(A)v$ and $fv:=f(B)v$ (for all $f\in F[X]$ and all $v\in F^n$) defines on $F^n$ a structure of finitely generated module over the principal ideal domain $F[X]$. Moreover, $A$ and $B$ are similar if and only if the corresponding modules are isomorphic. The good news is that a wonderful theory for the finitely generated modules over a principal ideal domain is freely available to us. TIDE
THEOREM 3. Let $A$ be a principal ideal domain and $M$ a finitely generated $A$-module. Then $M$ is isomorphic to $\oplus_{i=1}^nA/(a_i)$, where the $a_i$ are elements of $A$ satisfying $a_1\mid a_2\mid\cdots\mid a_n$. [As usual $(a)$ is the ideal generated by $a$ and $a\mid b$ means "$a$ divides $b$".] Moreover the ideals $(a_i)$ are uniquely determined by these conditions.
Let $K$ be the field of fractions of $A$, and $S$ a submodule of $A^n$. The maximum number of linearly independent elements of $S$ is also the dimension of the vector subspace of $K^n$ generated by $S$. Thus this integer, called the rank of $S$, only depends on the isomorphism class of $S$ and is additive with respect to finite direct sums.
THEOREM 4. In the above setting we have:
(a) $S$ is free of rank $r\le n$.
(b) There is a basis $u_1,\dots,u_n$ of $A^n$ and there are elements $a_1,\dots,a_r$ of $A$ such that $a_1u_1,\dots,a_ru_r$ is a basis of $S$, and $a_1\mid a_2\mid\cdots\mid a_r$.
Let $A$ be a commutative ring with one. Recall that $A$ is a principal ideal ring if all its ideals are principal, and that $A$ is a Bézout ring if all its finitely generated ideals are principal.
LEMMA. Let $A$ be a Bézout ring and let $c,d$ be in $A$. Let $\Phi$ be a set of ideals of $A$ such that: $(c)$ and $(d)$ are in $\Phi$; $(c)$ is maximal in $\Phi$; and $(ac+bd)\in\Phi$ for all $a,b\in A$. Then $c$ divides $d$ [equivalently $(c)$ contains $(d)$].
Proof. We have $(c,d)=(ac+bd)$ for some $a,b\in A$. This ideal belongs to $\Phi$, contains $(c)$ and is thus equal to $(c)$. Hence we get $(d)\subset(c,d)=(c)$. QED
PROPOSITION 1. Let $A$ be a principal ideal ring and $f$ an $A$-valued bilinear map defined on a product of two $A$-modules. Then the image of $f$ is an ideal.
Proof. Let $\Phi$ be the set of all ideals of the form $(f(x,y))$; pick $x,y$ such that $(f(x,y))$ is maximal in $\Phi$; and let $(f(u,v))$ be another element of $\Phi$. It suffices to show that $f(x,y)\mid f(u,v)$.
Claim: $f(x,y)\mid f(x,v)$ and $f(x,y)\mid f(u,y)$.
Since we have $af(x,y)+bf(x,v)=f(x,ay+bv)$ and $af(x,y)+bf(u,y)=f(ax+bu,y)$, the claim follows from the lemma.
By the claim we have $f(u,y)=af(x,y)$ and $f(x,v)=bf(x,y)$ for some $a,b\in A$. Setting $u'=u-av$, $v'=v-by$ we get $f(x,v')=0=f(u',y)$ and thus $af(x,y)+bf(u',v')=f(ax+bu',y+v')$. Now the lemma yields the conclusion. QED
We assume now that $A$ is a principal ideal domain.
Proof of Theorem 4. We assume (as we may) that $S$ is nonzero, we let $f:A^n\times A^n\to A$ be the dot product. By Proposition 1 the set $f(S\times A^n)$. Let $a_1=f(s_1,y_1)$ be a a generator of this ideal. [Naively: $a_1$ is a gcd of the coordinates of the elements of $S$.] Clearly, $u_1:=s_1/a_1$ is in $A^n$ and $f(u_1,y_1)=1$. Moreover we have
$$
A^n=Au_1\oplus (y_1)^\perp,\qquad S=As_1\oplus(S\cap(y_1)^\perp),
$$
where $(y_1)^\perp$ is the orthogonal of $y_1$. [The corresponding projection $A^n\twoheadrightarrow Au_1$ is given by $x\mapsto f(x,u_1)\,u_1$.] Then (a) follows by induction on $r$. Let us prove (b). By (a) we know that $(y_1)^\perp$ and $S\cap(y_1)^\perp$ are free of rank $n-1$ and $r-1$. By the induction hypothesis there is a basis $u_2,\dots,u_n$ of $(y_1)^\perp$ and there are elements $a_2,\dots,a_r$ of $A$ such that $a_2u_2,\dots,a_ru_r$ is a basis of $S\cap (y_1)^\perp$ and $a_1\mid a_2\mid\cdots\mid a_r$. It only remains to show $a_1\mid a_2$. We have $a_1\mid f(s,y)$ for all $(s,y)\in S\times A^n$. There is a $y$ in $A^n$ such that $f(u_2,y)=1$. Indeed, since the determinant of $(f(u_i,e_j))$ is $\pm1$, no prime of $A$ can divide $f(u_2,e_i)$ for all $i$, and we get $a_1\mid f(a_2u_2,y)=a_1$. QED
Proof of Theorem 3. First statement: Let $v_1,\dots,v_n$ be generators of the $A$-module $M$, let $(e_i)$ be the canonical basis of $A^n$, and let $\phi:A^n\twoheadrightarrow M$ be the $A$-linear surjection mapping $e_i$ to $v_i$. Applying Theorem 4 to the submodule $\operatorname{Ker}\phi$ of $A^n$, we get a basis $u_1,\dots,u_n$ of $A^n$ and elements $a_1,\dots,a_r$ of $A$ such that $a_1u_1,\dots,a_ru_r$ is a basis of $\operatorname{Ker}\phi$ and $a_1\mid a_2\mid\cdots\mid a_r$, and we set $a_{r+1}=\cdots=a_n=0$. Then $M$ is isomorphic to $\oplus_{i=1}^nA/(a_i)$, where the $a_i$ are as in Theorem 3.
Second statement: Assume that $M$ is also isomorphic to $\oplus_{i=1}^mA/(b_i)$, where the $b_i$ satisfy the same conditions as the $a_i$. We only need to prove $m=n$ and $(a_i)=(b_i)$ for all $i$. Let $p\in A$ be a prime. By the Chinese Remainder Theorem [see below] it suffices to prove the above equality in the case where $M$ is the direct sum of a finite family of modules of the form $M_i:=A/(p^{i+1})$ for $i\ge0$. For each $j\ge0$ the quotient $p^jM/p^{j+1}M$ is an $A/(p)$ vector space of finite dimension $n_j$. We claim that the multiplicity of $A/(p^{i+1})$ in $M$ is then $n_i-n_{i+1}$.
Here is a way to see this. Form the polynomial $M(X):=\sum n_jX^j$ (where $X$ is an indeterminate). We have
$$
M_i(X)=1+X+X^2+\cdots+X^i=\frac{X^{i+1}-1}{X-1}\ ,
$$
and we must solve $\sum\,m_i\,M_i(X)=\sum\,n_j\,X^j$ for the $m_i$, where the $n_j$ are considered as known quantities (almost all equal to zero). Multiplying through by $X-1$ we get
$$
\sum\,m_{i-1}\,X^i-\sum\,m_i=\sum\,(n_{i-1}-n_i)\,X^i,
$$
whence the formula. QED
PROPOSITION 2. Let $0\to A^r\overset f{\to}A^n\to M\to0$ be an exact sequence of $A$-modules. Then there are basis of $A^r$ and $A^n$ making the matrix of $f$ of the form
$$
\begin{bmatrix}
a_1\\
&\ddots\\
&&a_r\\
{}\\
{}\\
{}
\end{bmatrix}
$$
where only the nonzero entries are indicated. The ideals $(a_i)$ coincide with the ones given by Theorem 3. Moreover, if $\alpha$ is the matrix of $f$ relative to an arbitrary basis of $A^r$ and $A^n$, then the ideal of $A$ generated by the $k$-minors of $\alpha$ is $(a_1a_2\cdots a_k)$.
Proof. It suffices to prove the last sentence because the other statements follow immediately from Theorems 3 and 4. Let $\beta$ and $\gamma$ be rectangular matrices with entries in $A$ such that the product $\beta\gamma$ is defined. Clearly, if an element of $A$ divides each entry of $\alpha$, or if it divides each entry of $\gamma$, then it divides each entry of $\beta\gamma$. A similar statement holds if we replace $\beta$ and $\gamma$ with $\bigwedge^k\beta$ and $\bigwedge^k\gamma$. Thus, multiplying $\beta$ on the left or on the right by an invertible matrix does not change the ideal of $A$ generated by the $k$-minors. QED
Proof of Theorem 2. We will apply Proposition 2 to the principal ideal domain $F[X]$. It suffices to find an exact sequence of the form
$$
0\to F[X]^n\xrightarrow{X-A}F[X]^n\xrightarrow\phi F^n\to0.
$$
We do this in a slightly more general setting:
Let $K$ be a commutative ring, let $M$ be a $K$-module, let $f$ be an endomorphism of $M$, let $X$ be an indeterminate, and let $M[X]$ be the $K[X]$-module of polynomials in $X$ with coefficients in $M$. [In particular, any $K$-basis of $M$ is a $K[X]$-basis of $M[X]$.] Equip $M$ and $M[X]$ with the $K[X]$-module structures characterized by
$$
X^i\cdot x=f^ix,\qquad X^i\cdot X^jx=X^{i+j}x
$$
for all $i,j$ in $\mathbb N$ and all $x$ in $M$. Let $\phi$ be the $K[X]$-linear map from $M[X]$ to $M$ satisfying $\phi(X^ix)=f^ix$ for all $i,x$, and write again $f:M[X]\to M[X]$ the $K[X]$-linear extension of $f:M\to M$. It is enough to check that the sequence
$$
0\to M[X]\xrightarrow{X-f}M[X]\xrightarrow{\phi}M\to0
$$
is exact. The only nontrivial inclusion to verify is $\operatorname{Ker}\phi\subset\operatorname{Im}(X-f)$. For $x=\sum_{i\ge0}X^ix_i$ in $\operatorname{Ker}\phi$, we have
$$
x=\sum_{i\ge0}X^ix_i-\sum_{i\ge0}f^ix_i=\sum_{i\ge1}\,(X^i-f^i)\,x_i=(X-f)
\sum_{j+k=i-1}X^jf^kx_i.
$$
[Non-rigorous wording of the argument: Since $f$ is a root of the polynomial $P(X)=\sum X^ix_i$, the linear polynomial $X-f$ divides $P(X)$.]
QED
Here is a proof of the Chinese Remainder Theorem.
CHINESE REMAINDER THEOREM. Let $A$ be a commutative ring and $\mathfrak a_1,\dots,\mathfrak a_n$ ideals such that $\mathfrak a_p+\mathfrak a_q=A$ for $p\not=q$. Then the natural morphism from $A$ to the product of the $A/\mathfrak a_p$ is surjective. Moreover the intersection of the $\mathfrak a_p$ coincides with their product.
Proof. Multiplying the equalities $A=\mathfrak a_1+\mathfrak a_p$ for $p=2,\dots,n$ we get
$$
A=\mathfrak a_1+\mathfrak a_2\cdots\mathfrak a_n.\qquad(*)
$$
In particular there is an $a_1$ in $A$ such that
$$
a_1\equiv1\bmod\mathfrak a_1,\quad a_1\equiv0\bmod\mathfrak a_p\ \forall\ p>1.
$$
Similarly we can find elements $a_p$ in $A$ such that $a_p\equiv\delta_{pq}\bmod\mathfrak a_q$ (Kronecker delta). This proves the first claim. Let $\mathfrak a$ be the intersection of the $\mathfrak a_p$. Multiplying $(*)$ by $\mathfrak a$ we get
$$
\mathfrak a=\mathfrak a_1\mathfrak a+\mathfrak a\mathfrak a_2\cdots\mathfrak a_n\subset\mathfrak a_1\,(\mathfrak a_2\cap\cdots\cap\mathfrak a_n)\subset\mathfrak a.
$$
This gives the second claim, directly for $n=2$, by induction for $n>2$. QED