Sum of the series $\sum_{n=0}^{\infty} \lfloor nr \rfloor x^n$ where $r$ is rational? Can we find the exact sum of the series $\sum_{n=0}^{\infty} \lfloor nr \rfloor x^n$ where $r$ is rational?
There is a special case given here but I don't know how to prove it and can we get the sum for the general case?

First, this is not a full answer but enough significant progress that I felt it was worth typing up. 
Note that the sum only converges if $|x|<1$. As such, for the remainder of this post we shall assume $-1<x<1$.
Let $r=a/b$ be rational. If $r=a/b$ is an integer, then the sum is easily computed to be
$$\sum_{n=0}^\infty\left\lfloor n \frac{a}{b}\right\rfloor x^n=\sum_{n=0}^\infty n rx^n=\frac{r x}{(x-1)^2}$$
Thus, we may as well assume $r=a/b$ is not an integer from here on out. Now, we can write $n$ as $n=bq+s$ where $q\in\{0,1,2,3,...\}$ and $0\leq s <b$. Then
$$\left\lfloor n \frac{a}{b}\right\rfloor=\left\lfloor (bq+s) \frac{a}{b}\right\rfloor=qa+\left\lfloor s \frac{a}{b}\right\rfloor$$
Then the sum can be rewritten as
$$\sum_{n=0}^\infty \left\lfloor n \frac{a}{b}\right\rfloor x^n=\sum_{q=0}^\infty\sum_{s=0}^{b-1}\left\lfloor (bq+s) \frac{a}{b}\right\rfloor x^{bq+s}=\sum_{q=0}^\infty\sum_{s=0}^{b-1}\left(qa+\left\lfloor s \frac{a}{b}\right\rfloor\right) x^{bq+s}$$
We can split this sum into two parts:
$$\sum_{q=0}^\infty\sum_{s=0}^{b-1}\left(qa+\left\lfloor s \frac{a}{b}\right\rfloor\right) x^{bq+s}=\sum_{q=0}^\infty\sum_{s=0}^{b-1}qa x^{bq+s}+\sum_{q=0}^\infty\sum_{s=0}^{b-1}\left\lfloor s \frac{a}{b}\right\rfloor x^{bq+s}$$
The first infinite sum is easily found to be
$$\sum_{q=0}^\infty\sum_{s=0}^{b-1}qa x^{bq+s}=\frac{a x^b}{(x-1) \left(x^b-1\right)}$$
Since the second infinite sum converges absolutely, we may as well sum the $q$ sum before the $s$ sum. That is
$$\sum_{q=0}^\infty\sum_{s=0}^{b-1}\left\lfloor s \frac{a}{b}\right\rfloor x^{bq+s}=\sum_{s=0}^{b-1}\sum_{q=0}^\infty\left\lfloor s \frac{a}{b}\right\rfloor x^{bq+s}$$
$$=\sum_{s=0}^{b-1}\left(\left\lfloor s \frac{a}{b}\right\rfloor x^s\sum_{q=0}^\infty x^{bq}\right)=\sum_{s=0}^{b-1}\left(\left\lfloor s \frac{a}{b}\right\rfloor x^s\frac{1}{1-x^b}\right)$$
$$=\frac{1}{1-x^b}\sum_{s=0}^{b-1}\left\lfloor s \frac{a}{b}\right\rfloor x^s$$
The question then becomes: what is the sum
$$\sum_{s=0}^{b-1}\left\lfloor s \frac{a}{b}\right\rfloor x^s?$$
Now, we can slightly simplify this if we assume $a/b$ is in its most reduced form. That is, $\gcd(a,b)=1$ (if $a=0$, then the original sum is clearly $0$ so we may ignore this case). We may then write $a=mb+t$ for $m\in\mathbb{Z}$, $\gcd(t,b)=1$, and $0< t<b-1$. Note that if $t=0$, then $a/b$ is an integer. Otherwise, the sum is
$$\sum_{s=0}^{b-1}\left\lfloor s \frac{a}{b}\right\rfloor x^s=\sum_{s=0}^{b-1}\left\lfloor s \frac{mb+t}{b}\right\rfloor x^s=\sum_{s=0}^{b-1}\left\lfloor s \frac{mb+t}{b}\right\rfloor x^s$$
$$=\sum_{s=0}^{b-1}smx^s+\sum_{s=0}^{b-1}\left\lfloor s \frac{t}{b}\right\rfloor x^s=\frac{m \left(b x^{b+1}-x^{b+1}-b x^b+x\right)}{(x-1)^2}+\sum_{s=0}^{b-1}\left\lfloor s \frac{t}{b}\right\rfloor x^s$$
We have now further simplified the question to: what is the sum
$$\sum_{s=0}^{b-1}\left\lfloor s \frac{t}{b}\right\rfloor x^s$$
where $\gcd(t,b)=1$ and $0<t<b$? Unfortunately, this seems like a difficult problem. Here are the first few such sums, for $b=1,2,\cdots ,6$:
$$\left(
\begin{array}{c}
 \{0\} \\
 \{0\} \\
 \left\{0,x^2\right\} \\
 \left\{0,2 x^3+x^2\right\} \\
 \left\{0,x^4+x^3,2 x^4+x^3+x^2,3 x^4+2 x^3+x^2\right\} \\
 \left\{0,4 x^5+3 x^4+2 x^3+x^2\right\} \\
\end{array}
\right)$$
Overall, the sum is
$$\frac{a x^b}{(x-1) \left(x^b-1\right)}+\frac{1}{1-x^b}\left( \frac{m \left(b x^{b+1}-x^{b+1}-b x^b+x\right)}{(x-1)^2}+\sum_{s=0}^{b-1}\left\lfloor s \frac{t}{b}\right\rfloor x^s \right)$$
where $m=\lfloor a/b\rfloor$, $\gcd(t,b)=1$, and $0<t<b$.
Just to show that this answer is correct, we can rederive the special case given in the link above. In this case, $a=1$, implying the second term is $0$ as
$$m=\lfloor a/b\rfloor=\lfloor 1/b\rfloor=0$$
and
$$ \sum_{s=0}^{b-1}\left\lfloor s \frac{t}{b}\right\rfloor x^s =\sum_{s=0}^{b-1}\left\lfloor s \frac{1}{b}\right\rfloor x^s =\sum_{s=0}^{b-1}\left\lfloor  \frac{s}{b}\right\rfloor x^s =0$$
as $0\leq s<b$. Thus, the sum is simply
$$\frac{x^b}{(x-1) \left(x^b-1\right)}.$$
In the example, they use $k=1/x$, which gives us
$$\frac{ (1/k)^b}{((1/k)-1) \left((1/k)^b-1\right)}=\frac{ (1/k)^bk^{b+1}}{((1/k)-1) \left((1/k)^b-1\right)k^{b+1}}=\frac{k}{(k-1)(k^b-1)}$$
which is what they got.
