An integral identity for $\frac{x^{a-1}}{x^b-1}$ via. partial fractions Can somebody please confirm or correct the following? If $a$ and $b$ are both positive integers such that $a<b$ and $b$ is even then we can write
$$\frac{x^{a-1}}{x^{b}-1}=\frac{1}{b\left(x-1\right)}+\frac{\left(-1\right)^a}{b\left(x+1\right)}+\frac{2}{b}\sum\limits_{k=1}^{\frac{b-2}{2}}\frac{\cos\frac{2ak\pi}{b}\left(x-\cos\frac{2k\pi}{n}\right)-\sin^2\frac{2ak\pi}{b}}{x^2-2x\cos\frac{2k\pi}{b}+1},$$ and upon integration, I think we get
$$\int\frac{x^{a-1}}{x^{b}-1}dx=\frac{1}{b}\log\left(x-1\right)+\frac{\left(-1\right)^a}{b}\log\left(x+1\right)+\frac{1}{b}\sum\limits_{k=1}^{\frac{b-2}{2}}\cos\left(\frac{2ak\pi}{b}\right)\log\left(x^2-2x\cos\frac{2k\pi}{b}+1\right)-\frac
{2}{b}\sum\limits_{k=1}^{\frac{b-2}{2}}\frac{\sin^2\frac{2ak\pi}{b}}{\sin\frac{2k\pi}{b}}\tan^{-1}\frac{x-\cos\frac{2k\pi}{nb}}{\sin\frac{2k\pi}{b}}.$$
Context: I don't know my mistake at the moment, but I would like to get this instead $$\int\frac{x^{a-1}}{x^b-1}dx=\cdots-\frac{2}{b}\sum\limits_{k=1}^{\frac{b-2}{2}}\sin\left(\frac{2ak\pi}{b}\right)\tan^{-1}\frac{x-\cos\frac{2k\pi}{b}}{\sin\frac{2k\pi}{b}}.$$ That way, the formula could be used to derive another identity using the beta function which is my goal.
Sorry for length of the formula, I wasn't sure about appropriate question length.
 A: Mistake found
The rest of the partial fractions should have been found like so:
$$\frac{e^{\frac{2ak\pi}{b}i}}{x-e^{\frac{2k\pi}{b}i}}+\frac{e^{-\frac{2ak\pi}{b}i}}{x-e^{\frac{-2k\pi}{b}i}}=\frac{2\cos\frac{2ak\pi}{b}\left(x-\cos\frac{2k\pi}{b}\right)-2\sin\frac{2ak\pi}{b}\sin\frac{2k\pi}{b}}{x^2-2x\cos\frac{2k\pi}{b}+1},$$ which corrects the original formula for the fraction to
$$\frac{x^{a-1}}{x^{b}-1}=\frac{1}{b\left(x-1\right)}+\frac{\left(-1\right)^a}{b\left(x+1\right)}+\frac{2}{b}\sum\limits_{k=1}^{\frac{b-2}{2}}\frac{\cos\frac{2ak\pi}{b}\left(x-\cos\frac{2k\pi}{b}\right)-\sin\frac{2ak\pi}{b}\sin\frac{2k\pi}{b}}{x^2-2x\cos\frac{2k\pi}{b}+1},$$ which, upon integration, yields the formula
$$\int\frac{x^{a-1}}{x^{b}-1}dx=\frac{1}{b}\log\left(x-1\right)+\frac{\left(-1\right)^a}{b}\log\left(x+1\right)+\frac{1}{b}\sum\limits_{k=1}^{\frac{b-2}{2}}\cos\left(\frac{2ak\pi}{b}\right)\log\left(x^2-2x\cos\frac{2k\pi}{b}+1\right)-\frac
{2}{b}\sum\limits_{k=1}^{\frac{b-2}{2}}\sin\left(\frac{2ak\pi}{b}\right)\tan^{-1}\frac{x-\cos\frac{2k\pi}{b}}{\sin\frac{2k\pi}{b}}$$ which is the correct formula. The error was a simple error in expansion of the exponential terms.
