I'm trying to figure out how the modulo operation works using long division with negative dividends.
I know that $-1 \bmod 10 = 9$. But I can't figure out why.
For positive dividends, it's relatively straightforward.
$1 \bmod 10$ is the remainder of the long division of $1 ÷ 10$, which is $1$.

But when I try to find the remainder of the long division of $-1 ÷ 10$, I get $-1$, not $9$.

What am I doing wrong or failing to grasp?
When we divide $a$ by $b$ we can write $a=qb+r$ where $q$ is the quotient and $r$ is the remainder. We usually define $r \in [0,b-1]$ and it looks like you are doing so. In that case we write $-1=-1\cdot 10+9$, so the quotient is $-1$ and the remainder is $9$. You want the largest multiple of $b$ that is less than $a$. In your example that is $-10$, not $0$ as $0 \not \lt -1$