Srinivasa Ramanujan was one of the greatest mathematicians of all time $-$ the greatest in the $20^\text{th}$ century. One day, he stumbled across the equation $$\rm3^3+4^3+5^3=6^3\tag1$$ and only days later, he was able to discover the general form that this equation takes place in: $$\big(3a^2+5ab-5b^2\big)^3+\big(4a^2-4ab+6b^2\big)^3+\big(5a^2-5ab-3b^2\big)^3=\big(6a^2-4ab+4b^2\big)^3\tag2$$ for all integers $a$ and $b$, with Eq. $(1)$ being created when $a=1$ and $b=0$. Now I know that barely anyone knows how Ramanujan obtained his results $-$ but he did, and they are brilliant.
My question is, are there any useful techniques or methods that I can learn so I may be able to pull something like finding Eq. $(2)$? What algorithms are there to discover some general equations? I was not convinced when I looked at it, so I evaluated, and the left hand side weighs the same as the right hand side.
But are there any such algorithms at all? For example, $a^2-b^2$ looks like some regular expression, but just add in the clever substitution $ab - ab$ and then this happens: $$\begin{align}a^2-b^2&=a^2+ab-ab-b^2\\ &= a(a+b)-b(a+b) \\ &= (a+b)(a-b).\end{align}$$ So now when anybody says what $915^2-914^2$ is, I can say it right away: it is $915+914=1829$.
How does anybody know to put such clever substitutions? When I was first given the problem to factorise $a^2-b^2$, I just did this: $$\begin{align}(a-b)^2&=a^2-2ab+b^2 \\ \Leftrightarrow a^2-b^2&=(a-b)^2 + 2ab - 2b^2 \\ &= (a-b)^2 + 2b(a-b) \\ &= (a-b)(a-b+2b) \\ &= (a+b)(a-b).\end{align}$$ I got the same result, but it was not as efficient as the first method.
I want to become a great mathematician one day; I don't want to just tell my friends that I do math for a living $-$ I want to prove something, or make a theorem, especially if it involves prime numbers. What are some helpful algebraic formulae that I should know when it comes to constructing generalised equations and such? I know the quadratic and cubic formula... but that is it.
For example: $$x^2 + 3y^2 = 7z^2.$$ These are the forms that $x$, $y$ and $z$ must take for integers $p$ and $s$: $$\begin{align}x&=2\big(3p^2+3ps-s^2\big) \\ y&=-3p^2+4ps+s^2 \\ z&=3p^2+s^2.\end{align}$$ Go here to find some similar general equations (and let's not forget about pythagorean triples!).
How does one find such equations for $x$, $y$ and $z$? Is it just trial and error?
Thank you in advance, and I apologise if the post is too long and/or too broad.