Asymptotic expansion of a coefficients given functional equation of the generating function Given a functional equation ($0<q<1$)
$$ g(x)= \frac{1}{1-x} + \frac{q^2}{(1-(1-q) x)^3} g\left(\frac{q x}{1-(1-q) x}\right) $$
of the analytic function
$$ g(x) = \sum_{n=0}^\infty g_n x^n, $$
how can we extract the behaviour of $g(x)$ near $x=1$, and more importantly, to get the asymptotics for $g_n$ as $n$ is large?
I was able, using Mathematica, to express $g(x)$ in terms of QPolyGamma function, but I was unable to extract the asymptotics.
EDIT:
Motivation: Consider a game where you have $n$ players. Each player throw a dice. The players with number 6 $(q = 1/6)$ continue into the next round, until there is only one player. If no player scores 6, then the round is repeated for those players left. $g_{n-2}$ corresponds to expected number of rounds when there are $n$ players in the beginning. A harder problem is the following: Instead of repeating rounds, we will say winners going to the next round are those with highest scored number (1 to 5). This only changes $\alpha$ as the asymptotic is the same. However, I was not able yet to determine its precise value.
 A: After couple of hours, I think I have it:
$$g(x) \approx - \frac{1}{\ln q}\left(\frac{\ln\frac{1}{1-x}}{1-x}\right) + \frac{\alpha}{1-x}$$
from which the asymptotics should be
$$g_n \approx -\frac{H_{n+2}}{\ln q}+\alpha,$$
where
$$\alpha = \lim_{p\to 0}\left(-\frac{\ln p}{\ln
   q}+\sum _{k=0}^{\infty } \frac{q^{2 k}}{\left(p+q^k\right)^2}\right).\tag{0}$$
I. PROOF
The correct asymptotics ansatz is
$$g(x) = \gamma \frac{\ln\frac{1}{1-x}}{1-x} + \frac{\alpha }{1-x}+\beta  \ln \left(\frac{1}{1-x}\right)\tag{1}$$
to see that, we substitute this into
$$g(x) = \frac{1}{1-x} + \frac{q^2}{(1-(1-q)x)^3}g\left(\frac{x}{1-(1-q)x}\right)\tag{2}$$
which becomes, expanding in the neighbourhood of the singular point $x=1$:
$$ \frac{\gamma  \ln \left(\frac{1}{1-x}\right)}{1-x}+\frac{\alpha }{1-x}+\beta  \ln \left(\frac{1}{1-x}\right)=\frac{\gamma  \ln
   \left(\frac{1}{1-x}\right)}{1-x}+\frac{1+\alpha +\gamma  \ln (q)}{1-x}+\frac{(\beta -2 (1-q) \gamma ) \ln
   \left(\frac{1}{1-x}\right)}{q}+O(1).$$
Comparing:
$$\gamma = -\frac{1}{\ln q},\qquad \alpha \text{ arbitrary}, \qquad \beta = -\frac{2}{\ln q}.$$
Via Taylor expansion then from $(1)$
$$g_n \approx -\frac{H_{n}}{\ln q} + \alpha - \frac{2}{n \ln q} + O(1/n^2).$$
However, since $$H_n = \ln n+\gamma + \frac{1}{2 n} + O(1/n^2)$$ and thus
$$H_{n+2} = \ln n+\gamma + \frac{5}{2 n} + O(1/n^2),$$
we can write
$$g_n \approx -\frac{H_{n+2}}{\ln q} + \alpha + O(1/n^2).$$
II. ALPHA FORMULA
To see what $\alpha$ is equal to, based on $(2)$, we write ansatz expansion of $g(x)$ in the following form
$$g(x) = \sum_{j=0}^\infty \frac{x^j}{(1-x)^{j+3}} \psi_j. \tag{3}$$
Inserting this anzatz into $(2)$, we get the following series expansion.
$$\sum_{j=0}^\infty \frac{x^j}{(1-x)^{j+3}} \psi_j = \frac{1}{1-x}+ \sum_{j=0}^\infty \frac{x^j}{(1-x)^{j+3}} q^{j+2} \psi_j. \tag{4}$$
To extract the coefficients $\psi_j$, we write $x=z/(1+z)$, so $(4)$ becomes
$$\sum_{j=0}^\infty z^j \psi_j = \frac{1}{(1+z)^2}+ \sum_{j=0}^\infty q^{j+2} z^j \psi_j. \tag{5}$$
Hence, comparing $j-$th coefficient in $z$ small in $(5)$, we get the exact value for $\psi_j$
$$\psi_j = \frac{(-1)^j (j+1)}{1-q^{j+2}}.$$
Inserting this into $(3)$, and expanding in $q$,
$$g(x) = \sum_{j=0}^\infty \frac{x^j}{(1-x)^{j+3}} \frac{(-1)^j (j+1)}{1-q^{j+2}} = \sum_{j=0}^\infty \sum_{k=0}^\infty \frac{x^j}{(1-x)^{j+3}} (-1)^j (j+1) q^{k(j+2)} = \sum_{k=0}^\infty \frac{q^{2 k}}{(1-x) \left(x q^k-x+1\right)^2}.\tag{6}$$
Again, by writing $x = z/(1+z)$, we get from $(6)$,
$$g\left(\frac{z}{1+z}\right) = \sum_{k=0}^\infty \frac{(z+1)^3 q^{2 k}}{\left(z q^k+1\right)^2}.$$
Note that since $0<q<1$, the series converges for any $z\geq 0$. On the other hand, inserting $x=z/(1+z)$ into the ansatz asymptotics $(1)$, for $z$ large (and thus near $x = 1$),
$$ g\left(\frac{z}{1+z}\right) = \alpha  (z+1)+\log (z+1) (\beta +\gamma +\gamma  z) = z \gamma  \log (z)+\alpha  z+(\beta +\gamma ) \log (z)+O(1).$$
By comparison at $z \to \infty$, we get the following relation for $\alpha$
$$\alpha = \lim_{z\to \infty} \left(\frac{\ln z}{\ln q} + \left(\frac{1+z}{z}\right)^3 \sum_{k=0}^\infty \frac{q^{2k}}{\left(q^ k + \frac{1}{z}\right)^2} \right),$$
which is, after writing $z=1/p$, the same limit as in $(0)$. Restating,
$$\alpha = \lim_{p\to 0}\left(-\frac{\ln p}{\ln
   q}+\sum _{k=0}^{\infty } \frac{q^{2 k}}{\left(p+q^k\right)^2}\right).$$
III. EXACT ALPHA
Moreover, we are able to find the value $\alpha$ exactly. Via Euler-MacLaurin formula
$$\sum_{k=a}^b f(k)  = \int_a^b f(x) \, \mathrm{d}x + \frac{f(a)+f(b)}{2} + \sum_{m=1}^\infty \frac{B_{2m}}{(2m)!}(f^{(2m-1)}(b)-f^{(2m-1)}(a)),$$
for
$$f(k) = \frac{q^{2k}}{\left(p+q^k\right)^2},$$
we have
$$\int_0^\infty f(x) \,\mathrm{d}x = \frac{\frac{1}{p+1}+\ln \left(\frac{p}{p+1}\right)}{\ln q}, \qquad f(0)=\frac{1}{(1+p)^2}, \qquad f(\infty) = 0,$$
so
$$ \sum _{k=0}^{\infty } \frac{q^{2 k}}{\left(p+q^k\right)^2} =  \frac{\frac{1}{p+1}+\ln \left(\frac{p}{p+1}\right)}{\ln q} + \frac{1}{2(1+p)^2} + O(p)$$
from which we immediately get $$\alpha = \frac12 + \frac{1}{\ln q},$$
thus
$$g_n \approx -\frac{H_{n+2}}{\ln q} + \frac12 + \frac{1}{\ln q}.$$
