Take simple harmonic motion as an example. Start from the solution.
We know that the solution is $x=A\cos(\omega t+\phi)$ and we have $\dot x=-A\omega \sin(\omega t+\phi)$, where $A$ and $\phi$ are constants. Then we can guess the "energy" as $\omega^2x^2+\dot x^2=\omega^2 A^2$, which is a first integral of the system.
What is the standard procedure to "guess" all these first integrals out of $x$ and $\dot x$ for any system?