How do people come up with equations of curves to draw out complex objects?
Some popular examples would include: batman curve & PSY curve.
This stackexchange link explains the rationale for the batman curve nicely.
But other than trial and error, I can't see a reasonable way of drawing the much more complicated PSY curve.
Note that the Wolfram PSY curve is a parametric curve.
I would guess that the Wolfram PSY curve was created by drawing the curve first as a sequence of points in $\mathbb{R}^2$. This would correspond to a piece-wise affine ('linear') function $f:[0,1] \to \mathbb{R}^2$, with the property (among others) that $f(0)=f(1)$. Then take the Fourier series of $f$ and truncate at some point when the resulting curve looks reasonable.
This would be a straightforward (and tedious) way of drawing any 'closed' curve.