Motivation behind this eccentric Ramanujan Identity
I just visited the MathJaX page due to the Math.SE website showing some problems while loading the page. I saw some demo math equations samples at this page, when this identity actually caught my attention:
$$ \dfrac{1}{\Bigl(\sqrt{\phi \sqrt{5}}-\phi\Bigr) e^{\frac25 \pi}} = 1+\dfrac{e^{-2\pi}} {1+\dfrac{e^{-4\pi}} {1+\dfrac{e^{-6\pi}} {1+\dfrac{e^{-8\pi}} {1+\ldots} } } } $$
My question is how does one come up with such an identity. Could there be any motivation behind this or is this just brute force calculations and then discovering it as an identity.
As with Mariano, I too have no idea what sort of mathematical sorcery Ramanujan used, but what you have there is a special case of the Rogers-Ramanujan continued fraction (sans the $\sqrt[5]{q}$ factor).
Letting
$$R(q)=\cfrac{\sqrt[5]{q}}{1+\cfrac{q}{1+\cfrac{q^2}{1+\cdots}}}$$
the question amounts to how one might arrive at
$$R(\exp(-2\pi))=\sqrt{\phi\sqrt{5}}-\phi$$
As noted in this paper, Ramanujan had derived an explicit formula for $R(q)$ for certain special values of $q$ in his "lost notebook":
$$\begin{align*}R\left(\exp(-2\pi\sqrt{n})\right)&=\frac1{4t_n^2}\left((1-\phi t_n)\sqrt{1-t_n}-\sqrt{(1-t_n)(1+\phi t_n)^2-4\phi t_n}\right)\times \\&\left(\sqrt{(1-t_n)\left(1-\frac{t_n}{\phi}\right)^2+\frac{4 t_n}{\phi}}-\left(1+\frac{t_n}{\phi}\right)\sqrt{1-t_n}\right)\end{align*}$$
where $t_n=-\dfrac{G_{n/25}}{G_{25n}}$ and $G_n$ is the Ramanujan $G$-function (a.k.a. Ramanujan(-Weber) class invariant),
$$G_n=2^{-\frac14}q^{-\frac1{24}}\prod_{k=0}^\infty (1+q^{2k+1})=2^{-\frac14}q^{-\frac1{24}}(-q;q^2)_\infty$$
and $q=\exp(-\pi\sqrt n)$. (the details for proving it are a bit involved, but they can be seen in the linked paper, or here.)
Your case corresponds to $n=1$. Since $G_{1/n}=G_{n}$ (proven in this paper), $t_n=-1$, and making this substitution into the special formula for $R\left(\exp(-2\pi\sqrt{n})\right)$ yields the desired identity.
There is a lot of motivation behind this identity (although I don't know how it relates to Ramanujan's motivation, if at all). The function $R(q)$ described in J.M.'s answer is an example of a modular function (see the wikipedia entry), and the general theory of complex multiplication says that if $\tau$ is a quadratic irrational algebraic number (e.g. $i$) then the value of any modular function at $q = e^{2\pi i\tau}$ lies in an abelian extension of $\mathbb Q(\tau).$
In the particular case of your identity, $\tau = i$ (so $q = e^{-2\pi}$), and the abelian extension is $\mathbb Q(i,\sqrt{5})$. The reason that $5$ appears here is related to the fact that the level of the modular function $R(q)$ equals $5$.
For more details from this point of view, you can look at this nice article of William Duke.
Unfortunately Ramanujan never told how he arrived at his most beautiful formulas and hence we can only guess at his motivation behind such formulas. From whatever I have studied about Ramanujan, I find that he had a great love for algebraic manipulations of all sorts especially manipulating expressions containing radicals. If there were two mathematical entities having any algebraic relation between them, then Ramanujan would find the relation without much effort.
Thus while Legendre and Jacobi derived modular equations upto 3 and 5th degree, Ramanujan went on to derive a huge number of modular equation of higher degrees and presented them in such convenient form as no one else had done. Having found modular equations he did not stop there, but rather based on these modular equations he calculated a host of various algebraic numbers like singular moduli and class invariants. He used these algebraic numbers for finding algebraic approximations to $\pi$. Naturally when he encountered Rogers-Ramanujan continued fraction he tried to figure out if it had algebraic values at certain points and when convinced so he started finding such values.
And it was because of this particular formula in his letter to G. H. Hardy that he became famous. Hardy said that these formulas must be true because if they were not true then nobody would have had the imagination to invent them. A proof based on Ramanujan's theories is presented in one of my blog posts.
Also when we pick one formula of Ramanujan and put it out of context, it looks much more strange and mystical. Ramanujan extensively studied various functions related to elliptic and theta functions and found algebraic relationships between them and when we study his formulas in context (as presented by Bruce C Berndt in Ramanujan's Notebooks) they start to look less strange and it looks as if each formula fits nicely in the grand scheme of theories created by Ramanujan.