Existence in this case is guaranteed by theorems. In case you wish to perform the task for an actual matrix...
It is not necessary to use eigenvalues in this case. Sylvester's Law of Inertia concerns this: $P^T AP = D,$ where $A$ is symmetric, $P$ is nonsingular (but NOT necessarily orthogonal) and $D$ is diagonal. This relationship is often called "congruence," especially if we arrange that the determinant of $P$ be equal to one.
The easiest method is essentially "completing the square," associated with Hermite more or less. There is a method that is entirely cookbook; I collected several examples on this site. Note that I did eventually find a recent book that had this, called Linear Algebra Done Wrong by TREIL. Oh: at the end, you have a diagonal matrix $D.$ One further step, for each nonzero diagonal entry $\lambda$ make another diagonal matrix $Q,$ where the matching element is $1 \sqrt {|\lambda|}.$ Then $Q^T DQ = QTQ$ has diagonal entries all $1,0,-1.$
reference for linear algebra books that teach reverse Hermite method for symmetric matrices
Bilinear Form Diagonalisation
Given a $4\times 4$ symmetric matrix, is there an efficient way to find its eigenvalues and diagonalize it?
Find the transitional matrix that would transform this form to a diagonal form.
Writing an expression as a sum of squares
Determining matrix $A$ and $B$, rectangular matrix
Method of completing squares with 3 variables
Using Lagrange's diagonalization on degenerate linear forms
a question about a canonical form of a quadratic form using Gauss theorem