<s>[INST] Combinatorics generating functions of a series Hi I found that the generating function of a series $a_n$ is:
$$\frac{(1-x)(1+2x)}{(1+3x)(1-3x)}$$
I need to find a formula for $a_n$.
I tried some things and found that the generating function is equal to:
$$\frac{1}{3}\cdot (1+2x)\cdot( \frac{2}{1+3x} + \frac{1}{1-3x})$$
but I cant get any further than that. 
 [/INST] Your approach  is fine.  We see or obtain with polynomial division
\begin{align*}
1+2x=\frac{2}{3}(1+3x)+\frac{1}{3}\quad&\Longrightarrow\quad\frac{1+2x}{1+3x}=\frac{2}{3}+\frac{1}{3(1+3x)}\\
1+2x=-\frac{2}{3}(1-3x)+\frac{5}{3}\quad&\Longrightarrow\quad\frac{1+2x}{1-3x}=-\frac{2}{3}+\frac{5}{3(1-3x)}\tag{1}
\end{align*}

We start with OPs expression and obtain with (1) and the geometric series expansion
\begin{align*}
\color{blue}{\frac{1}{3}}&\color{blue}{(1+2x)\left( \frac{2}{1+3x} + \frac{1}{1-3x}\right)}\\
&=\frac{2}{3}\cdot\frac{1+2x}{1+3x}+\frac{1}{3}\cdot\frac{1+2x}{1-3x}\\
&=\frac{2}{3}\left(\frac{2}{3}+\frac{1}{3(1+3x)}\right)+\frac{1}{3}\left(-\frac{2}{3}+\frac{5}{3(1-3x)}\right)\\
&=\frac{2}{9}+\frac{2}{9}\sum_{n=0}^\infty(-3)^nx^n+\frac{5}{9}\sum_{n=0}^\infty 3^nx^n\\
&\,\color{blue}{=\frac{2}{9}+\sum_{n=0}^\infty\frac{1}{9}\left(2(-1)^n+5\right)3^nx^n}
\end{align*}

</s>