Just stumbled upon this question. Yes there is a general theory for finding the rational functions $i$. First note that linear rational functions, i.e. rational functions of the form $\frac{ax+b}{cx+d}$ with $ad-bc\neq 0$, form a group under composition over any field $K$. Let's call this group $M$ (It is actually isomorphic to $\operatorname{PGL}_2(K)$). The crucial assumption we need to make is that $G\le M$ is a finite subgroup of $M$. If this is satisfied it can be shown that the set $$K(x)^G:=\{Q\in K(x)\mid Q(\frac{ax+b}{cx+d})=Q(x) \text{ for all } \frac{ax+b}{cx+d}\in G\}$$ is a subfield of $K(x)$ such that $[K(x):K(x)^G]=|G|$. By Lüroth's theorem every subfield $L$ of the rational function field $K(x)$ such that $[K(x):L]<\infty$ is a rational function field itself, i.e. there is a rational function $i\in K(x)$ such that $L=K(i)$. Hence $K(x)^G=K(i)$ for some $i\in K(x)$.
If what I wrote was a bit too much just remember this: If $G$ is a finite subgroup of $M$ we can find a rational function $i$ such that any rational function $Q$ invariant under $G$ can be written as $Q(x)=R(i(x))$ with $R\in K(x)$.
To find this $i$ I know of two methods that always work and one that is a good try.
The good try is what you already did in your question. Just add or multiply all the rational functions in $G$ together. If it is a proper rational function $i\in K(x)\setminus K$ then it is a rational function you are looking for. Note that the rational function $\frac{x+2}{x-1}$ is of order $2$ and thus $x+\frac{x+2}{x-1}$ and $x\frac{x+2}{x-1}$ are the sum/product of all the elements of the cyclic group generated by $\frac{x+2}{x-1}$. An example where this fails is the group $G=\{x,-x,1/x,-1/x\}$ in characteristic $\neq 2$, because $$x+(-x)+1/x+(-1/x)=0$$ and $$x\cdot 1/x\cdot (-x)\cdot (-1/x)=1.$$
The method that always works is a generalization of the above. Consider the polynomial $$P(y)=\prod_{A(x)\in G}(y-A(x))\in K(x)[y].$$ It can be shown that one of the coefficients of $P(y)$ has to be a generator of $K(x)^G$ and thus is a rational function you are looking for. Note that the coefficients before the $y^{|G|-1}$ and $y^0$ are exactly the rational functions we obtain by adding/multiplying the rational functions out of $G$ together (up to $\pm 1$).
Applying this for $G=\{x,-x,1/x,-1/x\}$ yields the polynomial $$P(y)=y^4-(x^2+\frac{1}{x^2})y^2+1,$$ hence $i(x)=x^2+1/x^2$ is a generator.
The second method that always works is by considering the zeros and poles of the generators, but this answer is long enough as is so I'll just refer you to my favorite paper dealing with this: Section 3.3 in https://arxiv.org/pdf/1906.08944.
As a sidenote I want to add that if you have obtained a generator $i$ then any other generator $i'$ can be obtained by $i'(x)=A(i(x))$ whereby $A$ is a linear rational function.