<s>[INST] How does one construct general forms that certain variables in an equation must take? 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.
 [/INST] (OP) enquiry about derivation of the Ramanujan Identity. Derivation is given below:
Assume that below equation is true:
$\big(3p^2+mp-5\big)^3+\big(4p^2-np+6\big)^3+\big(5p^2-mp-3\big)^3=\big(6p^2-np+4\big)^3\tag1$
Let: 
$u=3p^2+mp-5$
$v=4p^2-np+6$
$w=5p^2-5p-3$
$z=6p^2-np+4$
We have identity:
$(a+b+c)^3=a^3+b^3+c^3+3(a+b)(b+c)(c+a)$
Hence $(u^3+v^3+w^3-z^3)$=
$(3p+m)(mp-5)(3p^2-5)-(5p-m)(mp+3)(5p^2-3)-2(3p^2+2)(4-np)(6p-n)+2(2p^2+3)(6-np)(4p-n)=0$
or
$4p^4(5n-4m)+2p^3(4m^2-n^2-84)-2p(4m^2-n^2-84)-4(5n-4m)=0$ -----(2)
Equation  (2) has solution at $(m,n)=(5,4)$
Hence after substituting in equation (1) $(m,n,p)=(5,4,(a/b))$ we get:
$\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$
</s>