Sum of first n terms of this series Given a digit x (between 0 to 9, inclusive) and a number n, calculate the sum of the first n terms of the following sequence:
\$x,10x+x,100x+10x+x,\dots\$
For example, if x is 6 and n is 2, then the result will be 6+66 meaning 72.
There can be trailing whitespace in the output but not leading whitespace.
Python 2, 28 bytes

lambda x,n:(10**-~n/9-n)/9*x

Try it online!
-6 thanks to @Bubbler and @tsh
Aha the first answer I have used some math
How?
Let's call \$n^{th}\$ term as \$y\$
$$
S_n=x+(10x+x)+(100x+10x+x)+.....+y\\= x+(11x)+(111x)+.....+y\\=\frac{x}{9}(9+99+999+.....+y)\\=\frac{x}{9}((10-1)+(100-1)+(1000-1)+.....+y)\\=\frac{x}{9}((10+100+1000+.....+y)-(1+1+1+.....+1))\\=\frac{x}{9}((10^1+10^2+10^3+...+y)-n)\\=\frac{x}{9}(\frac{10(10^n-1)}{10 - 1}-n)\\=\frac{x}{9}(\frac{10(10^n-1)-9n}{9})\\=\frac{x(10(10^n-1)-9n)}{81}
$$
And we get our magic formula!