As already mentioned in the comments, a subring of a UFD does not have to be a UFD. I like the following illuminating example:
Let $k$ be a field and consider the ring of polynomials $k[t]$ and its subring $k[t^2,t^3]$, which consists of all polynomials with zero linear term. It is not a UFD: the element $t^6$ has two factorizations into a product of irreducible elements $$t^6=t^2\cdot t^2\cdot t^2=t^3\cdot t^3.$$
Of course, $t^6$ has an essentially unique factorization in $k[t].$ The issue is in the absence of $t$ - by killing it off, we made two irreducible elements $t^2$ and $t^3$ "incomparable".
A formal power series in the ring $R$ is a sequence
$$
(a_0, a_1, \ldots ),
$$
where the $a_i$ lie in $R$, although this is more often
denoted by
$$
\sum_{n=0}^\infty a_nX^n.
$$
Nevertheless, all of the symbols you see above, except for the coefficients $a_i$ themselves, are just superfluous decorations.
The set of all formal power series is denoted by $R[[X]]$ and it has the structure of a ring, where you add two formal
power
series just by adding their respective coefficients, while the multiplication is defined by
$$
\Big (\sum_{n=0}^\infty a_nX^n\Big ) \Big (\sum_{n=0}^\infty b_nX^n\Big )= \Big (\sum_{n=0}^\infty c_nX^n\Big ),
$$
where
$$
c_n:= \sum_{k=0}^n a_k b_{n-k}.
$$
In addition, $R[[X]]$ is a topological ring by identifying it with the product topological space $R^{\mathbb N}$ in the obvious way, where $R$ is
given the discrete topology.
This means that a sequence
$$
\Big\{\sum_{n=0}^\infty a_{n, k}X^n\Big\}_k
$$
converges to an element $\sum_{n=0}^\infty a_nX^n$ in $R[[X]]$, if and only for every $n$, there is a $k_0$, such that
$a_{n,k}= a_n$, for every $k\geq k_0$. In others words, if you focus on the coefficients of a single $X^n$, you'll notice they stop changing after a while.
Whenever you have a topological ring, you can make sense of convergence of "infinite sums", such as, $\sum_{n=0}^\infty P_n$, by simply
interpreting it as the sequence of partial sums
$$
\Big\{\sum_{n=0}^N P_n\Big\}_N.
$$
In the case of $R[[X]]$, one may choose $P_n: = a_nX^n$ as a formal power series in which all coefficients, except for
$a_n$, are taken to be zero. In that case you may ask whether or not the "infinite sum"
$$
\sum_{n=0}^\infty a_nX^n.
$$
converges in $R[[X]]$. Besides observing that the above is NOT to be understood as an element of $R[[X]]$ (it is an
infinite sum of elements of $R[[X]]$), it is not hard to see that it does converge (Exercise: prove it!) to the element
of $R[[X]]$ you might write as $(a_0, a_1, \ldots )$ in its most formal presentation.
This might be expressed by saying that every power series converges in the ring of formal power series, regardless of how big the coefficients are!
Best Answer
The formal power series $\frac{1+x}{1+2x+x^2}$ can be simplified. We consider the ring $\mathbb{C}[[x]]$ of formal power series, where we take as ring the field $\mathbb{C}$. The formal power series \begin{align*} A(x)=1+x\in\mathbb{C}[[x]] \end{align*} has a constant term $1\ne 0$ which guarantees the existence of a multiplicative inverse $A^{-1}(x)$ with \begin{align*} A(x)A^{-1}(x)=1 \end{align*} The multiplicative inverse $A^{-1}(x)=1-x+x^2-x^3+\cdots=\sum_{n=0}^\infty (-1)^nx^n$ and we can easily show \begin{align*} \color{blue}{A(x)A^{-1}(x)}&=(1+x)\sum_{n=0}^\infty (-1)^nx^n\\ &=\sum_{n=0}^\infty (-1)^nx^n+\sum_{n=0}^\infty (-1)^nx^{n+1}\\ &=\sum_{n=0}^\infty (-1)^nx^n-\sum_{n=1}^\infty (-1)^nx^{n}\\ &\,\,\color{blue}{=1} \end{align*}
Two more aspects:
We recall the multiplicative inverse of formal power series is unique provided it exists.
We commonly write the inverse multiplicative of a formal power series $C(x)$ as \begin{align*} \frac{1}{C(x)}:=C^{-1}(x) \end{align*} which enables us to write \begin{align*} A^{-1}(x)=\frac{1}{1-x}=1-x+x^2-x^3+\cdots \end{align*}
Note we do not use any Taylor series expansion which considers a power series as analytic object where coefficients are defined via (analytic) derivatives. We do also not consider any radius of convergence since $x\in\mathbb{C}[[x]]$ is just a formal placeholder for a sequence $(0,\color{blue}{1},0,0,\ldots)$ and is not subject of evaluation at certain points of $\mathbb{C}$.