About digits sum and divisibility Let $D$ be the function define as $D(b,n)$ be the sum of the base-$b$ digits of $n$.
Example: $D(2,7)=3$ means $7=(111)_2\implies D(2,7)=1+1+1=3$
Define $S(a,m)=1^m+2^m+3^m+...+a^m$ where $a,m\in\mathbb{Z}_+$

Edit:-Update claim

For $m$ is every positive integer. How do you show that
If $a\nmid S(a-1,m)$
Then $D(a,a^{m+1}-S(a,m))+D(a,S(a-1,m))=(a-1)(m+1)$?
And
If $a\mid S(a-1,m)$
Then $D(a,a^{m+1}-S(a,m))+D(a,S(a-1,m))\ne(a-1)(m+1)$?

Source code
n1= 2
o = 1
while n1 < 100:
    m = 2
    print("\n n1=",n1)
    #print("m=",m)

    num=n1
    sum_num = 0

    for i in range(1, num): 
        sum_num += i**(m)
    n2 = (sum_num)

    if(n2%num == 0):
        print("div & sum=",n2)
    else:
        print("not div & sum=",n2)



    rem_array = []
    while n2 != 0:
        mod = n2%n1
        if mod != 0:
          rem = mod
          n2 = n2 - rem
          rem_array.append(round(rem))
          n2 = n2/n1
        else:
            n2 = n2/n1
            rem_array.append(0)

    print(rem_array[::-1],sum(rem_array))
#    print(sum(rem_array))

    n2=(sum_num)+n1**m
    rem1_array = []
    while n2 != 1:
        mod = n2%n1
        if mod != 0:
          rem1 = n1-mod
          n2 = n2 + rem1
          rem1_array.append(round(rem1))
          n2 = n2/n1
        else:
            n2 = n2/n1
            rem1_array.append(0)
#   print(rem_array)
    print(rem1_array[::-1],sum(rem1_array))
    if((n1-1)*(m+1) == sum(rem_array)+sum(rem1_array)):
        print("oooooooooook")
    print("(a-1)(m+1)=",(n1-1)*(m+1))



    n1 += o


Update claim helps to show below claim

For $m$ is even positive integer. How do you show that
If $(a-1)\mid S(a-1,m)$
Then $D(a,a^{m+1}-S(a,m))+D(a,S(a-1,m))=(a-1)(m+1)$?


We can easily prove for every prime$-p>m+1$ is $p\mid S(p,m)$
Formula
$$ S(a,n)= \sum_{i=1}^{a} i^{n}=\sum_{b=1}^{n+1} \binom{a}b\sum_{j=0}^{b-1} (-1)^{j}(b-j)^{n}\binom{b-1}j$$
for formula
Proof
Let $a=p(prime)>n+1$
We can see, $a$ can be common out from $\sum_{b=1}^{n+1}\binom{a}b\sum_{j=0}^{b-1} ...$
$\implies a|S(a,n)$
 A: Your equation $D(a,a^{m+1} - S(a,m)) + D(a,S(a-1,m)) = (a-1)(m+1)$ is not always true when $(a-1) \mid S(a-1,m)$.  
For example, take $a=4$, $m=3$.  $S(3,3) = 1^3 + 2^3 + 3^3$ is divisible by $3$, but
$D(4,4^4 - S(4,3)) + D(4,S(3,3)) = 6+3=9$ while $(4-1)(3+1) = 12$.
A: Proof for update claim:
Clearly for $a\gt1$, $a^m\lt (S(a,m))\lt a^{m+1}$ so $(S(a,m))_a$ have  $m+1$ digits in base-$a$
Thus, in base $a$,
$$S(a,m) = \sum_{i=0}^{m}b_i a^i, \; 0 \le b_i \le a - 1 \text{ for } 0 \le i \le m - 1, \text{ and } 1 \le b_m \le a - 1 \tag{1}\label{eq1A}$$
$$\begin{equation}\begin{aligned}
S(a,m) &=(b_m b_{m-1} ... b_1 b_0)_a \\
a^{m+1}-S(a, m) & = a^{m+1}-\sum_{i=0}^{m}b_ia^{i} \\
& = (10...00)_a-(b_m b_{m-1} ... b_1 b_0)_a \\
& = (b'_{m} b'_{m-1} ... b'_1 b'_0)_a
\end{aligned}\end{equation}$$
note- 
•$D(a,S(a,m)) = 1 + D(a,S(a-1,m)) \tag{2}\label{eq2A}$
So $S(a-1,m)= (b^*_{m} b_{m-1} ... b_1 b_0)_a$ where digit $b^*_m=b_m-1$
proof for (2)
•if $a\mid S(a,m)$ then $b_0=b'_0=0$.$\tag{3}$
By $(1),(2)$ and $(3)$ follows 
If $a\nmid S(a-1,m)$ then
$$\begin{equation}\begin{aligned}
& D(a,a^{m+1}-S(a,m))+D(a,S(a-1,m)) \\
&=(b'_m+b'_{m-1}+...+b'_0)+(b^*_m+b_{m-1}+...+b_0) \\ &=(b'_m+b^*_m)+(b'_{m-1}+b_{m-1})+...+(b'_0+b_0) \\ &=(a-2)+(a-1)+(a-1)+...+(a-1)+(a) \\ &=(a-1)(m+1)
\end{aligned}\end{equation}$$
And if $a\mid S(a-1,m)$ then $b_0=b'_0=0$ implies $D(a,a^{m+1}-S(a,m))+D(a,S(a-1,m))\ne (a-1)(m+1)$

Proof for second claim:
Because we now know, if $a\nmid S(a,m)$ then $D(a,a^{m+1}-S(a,m))+D(a,S(a-1,m))= (a-1)(m+1)$ so we only need to prove,"For m is even, if $a-1\mid S(a-1,m)$ then $a\nmid S(a,m)$" was I already asked here
