I found two examples that I'd like to understand:
Example 1: Find $112358132134 \mod 9$.
Solution is: $1+1+2+3+5+8+1+3+2+1+3+4 \mod 9 = 7 \mod 9 = 7$
Example 2: Find $62831853 \mod 11$.
Solution is: $(-6)+2+(-8)+3+(-1)+8+(-5)+3 \mod 11 = -4 \mod 11 = 7$
My question is: Based on what property we sum the digits of the number ( as Example 1) or subtract (as Example 2)?
Usually, we cannot compute the remainder of a number mod $n$ by summing the digits (example 1), or by subtracting alternately (example 2). This is a special trick that works for mod $9$ and $11$. It also works for mod $3$.
To compute the remainder of a number mod $3$ or mod $9$, you may sum the digits and then compute the remainder of that result.
Why it works: we write numbers in base $10$, and $10 \equiv 1$ mod $3$ or mod $9$, so multiplying by $10$ is really multiplying by $1$.
To compute the remainder of a number mod $11$, you may alternately add and subtract the digits and then compute the remainder of that result.
Why it works: we write numbers in base $10$, and $10 \equiv -1$ mod $11$, so multiplying by $10$ is really multiplying by $-1$ (changing the sign).
You can read more about these divisibility rules and others at this Wikipedia page.