Yikes, that's quite a function- I don't envy you!
I'd try something like

You'll notice that I've used a lot of \left(...\right), and also some \left. and \right. Essentially the main thing is to introduce a local function F
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
f(x)&=\left(\prod_{i=1}^n\left(\left(y\left(\left\lceil\frac{i-1}{i}\right\rceil\right)+1\left|\left(\left\lceil\frac{i-1}{i}\right\rceil\right)-1\right|\right)2^{F\left(x\right)}-1\right)\frac{1}{3_i}\right)\left(x\right)
\intertext{where}
F(x)&= \left(2\left(g(x)+\left(\left\lceil\frac{i}{3}\right\rceil\right)\right.\right. \cdot \left(\left\lceil\frac{\left(y\right)\left(2^{|y\,\bmod\,3-3|}\right)-1}{9}\,\bmod\,1\right\rceil\right)\left(\left\lceil\frac{i-1}{i}\right\rceil\right)\\
&\phantom{=}+\left(\left\lceil\frac{i+2}{3}\right\rceil\right)\cdot \left(\left|\left\lceil\frac{\left(y\right)\left(2^{|y\,\bmod\,3-3|}\right)-1}{9}\,\bmod\,1\right\rceil-1\right|\right)\left(\left\lceil\frac{i-1}{i}\right\rceil\right)\\
&\phantom{=}+\left(\left\lceil\frac{i+1}{3}\right\rceil\right)\cdot \left.\left(\left|\left\lceil\frac{i-1}{i}\right\rceil-1\right|\right)\right)\\
&\phantom{=}+\left.\vphantom{\frac{1}{2}}|(g(x)\,\bmod\,3)-3|\right)
\end{align*}
\end{document}
$$. Please see Why is [ … ] preferable to $$?. – Peter Grill Jun 14 '12 at 05:543_iin the end? In the beginning, do you really want a factor1in front of the absolut value? And: what does the(x)in the very end mean? In which sense is that product a function ofx? You already haveF(x)within the product! – Hendrik Vogt Jun 14 '12 at 18:17