I didn't fully get the first one, $SAS^T$.
But it doesn't really matter, as we can exchange $S$ and $T$ by taking $T:=S^T$, then $SAS^T=T^TAT$ as wished, and of course $S$ is invertible iff $S^T$ is invertible.
Let $e_1,e_2,...$ denote the standard basis of $\Bbb R^n$, and let $A$ be a symmetric matrix. Then the bilinear form it determines is
$$(x,y)\mapsto x^TAy$$
and observe that $A_{i,j}=e_i^TAe_j$, so, multiplying by the basis elements will give the matrix coefficients. Now, if we have another basis, $s_1,...,s_n$, and put them (as column vectors) in the matrix $S:=[s_1|s_2|..|s_n]$, then the rows of $S^T$ are $s_1^T,s_2^T,...$, and so
$$S^TAS=(s_i^TAs_j)_{i,j}\,,$$
that is, the matrix of the bilinear (quadratic) form, w.r.t. the basis $s_1,s_2,..$, is $S^TAS$.
Well, if one writes (in a rather unusual way) the basis vectors in the rows of a matrix, i.e. starts with $S^T$ instead of $S$, then of course, it would lead to $SAS^T$...
For instance, if $a,b>0$ and $\displaystyle A = \begin{bmatrix}a & 0 \\ 0 & b\end{bmatrix}$, how would one make this congruence transformation to get a basis in which $A=I$?
In this case you can take $S$ to be $\begin{bmatrix}\frac 1{\sqrt{a}} & 0 \\ 0 &\frac 1{\sqrt{b}}\end{bmatrix}$, or in other words taking $\mathbf e'_1=\frac 1{\sqrt{a}}\mathbf e_1$ and $\mathbf e'_2=\frac 1{\sqrt{b}}\mathbf e_2$.
In general the question we want to answer is: Given a basis and an inner product, find a new basis which is orthonormal for that product. This is done by the Gram–Schmidt process.
EDIT: The question has been updated slightly to ask this question:
This is, can we diagonalise simultaneously two quadratic forms in such a way that one of them is seen from a new basis as I, and the other one as a diagonal matrix whose entries are the proper eigenvalues?
The answer is yes. Suppose our real symmetric matrices are $A$ and $B$. As above, find an orthonormal basis so that $A\mapsto I$. Then if we change basis again by an orthogonal matrix (one such that $O^T=O^{-1}$) we will find that the matrix for $A$ is still $I$ (because it becomes $OIO^T=OIO^{-1}=I$. So we are done by the fact that real symmetric matrices can be diagonalised by orthogonal matrices.
Best Answer
The basis for your quadratic form is the natural basis, i.e., $(1, 0,\cdots, 0), \cdots, (0, \cdots, 0, 1)$. The matrix of quadratic form depends on the basis. Canonical form of a symmetric matrix is a diagonal matrix. You may compare these two forms...