I am hoping someone can explain why the second step has a $$o(\lg^k{n})$$ and then in the next step how the Riemann sum is simplified and the change of sign.
$$ B = \sum_{j=0}^{\log_b{n}-1}\lg^k\frac{n}{b^j} = \sum_{j=0}^{\log_b{n}-1}\Big(\lg^k{n} - o(\lg^k{n})\Big) = \log_b{n}\lg^k{n} + \log_b{n} \cdot o(\lg^k{n}) = \Theta(\log_b{n}\lg^k{n}) = \Theta(\lg^{k+1}{n}) \\ $$
Thank you,
I'll play around and see what happens.
$\begin{array}\\ B &= \sum_{j=0}^{\log_b{n}-1}\lg^k\frac{n}{b^j}\\ &= \sum_{j=0}^{\log_b{n}-1}\left(\lg\frac{n}{b^j}\right)^k\\ &= \sum_{j=0}^{\log_b{n}-1}\left(\lg(n)-j\lg(b)\right)^k\\ &= \sum_{j=0}^{\log_b{n}-1}\lg^k(n)\left(1-\frac{j\lg(b)}{\lg(n)}\right)^k\\ &= \lg^k(n)\sum_{j=0}^{\log_b{n}-1}\left(1-\frac{j}{\log_b(n)}\right)^k\\ &= \lg^k(n)\sum_{j=0}^{\log_b{n}-1}\left(1-c(j)\right)^k \qquad\text{where }0 \le c(j) < 1\\ &= \lg^k(n)\sum_{j=0}^{\log_b{n}-1}\left(d(j)\right)^k \qquad\text{where }0 \lt d(j) \le 1\\ &= \lg^k(n)\sum_{j=0}^{\log_b{n}-1}e(j) \qquad\text{where }0 \lt e(j) \le 1\\ \end{array} $
Therefore $B < \log_b(n)\lg^k(n) = O(\lg^{k+1}(n)) $ where the constant in the big-oh depends on the base implied by $\lg$ (probably 2).
To get an approximation for the sum, let $v = \log_b(n)$. Then
$\begin{array}\\ \sum_{j=0}^{\log_b{n}-1}\left(1-\frac{j}{\log_b(n)}\right)^k &=\sum_{j=0}^{v-1}\left(1-\frac{j}{v}\right)^k\\ &\approx v\int_0^1 (1-x)^k dx \qquad\text{since }\left(1-\frac{j}{v}\right)^k \approx v\int_{j/v}^{(j+1)/v} (1-x)^kdx\\ &= v\int_0^1 x^k dx\\ &=\frac{v}{k+1}\\ &=\frac{\log_b(n)}{k+1}\\ \end{array} $
so, since $\log_b(n) =\frac{\lg(n)}{\lg(b)} $, $B \approx \lg^k(n)\frac{\log_b(n)}{k+1} = \lg^{k+1}(n)\frac{1}{\lg(b)(k+1)} =\Theta(\lg^{k+1}(n)) $.