The aspect you're puzzled by, $(5^{40} \bmod 7) \equiv (5^{32} \bmod 7)(5^{8} \bmod 7) \pmod 7$, is really the same process that has been used through the whole squaring process that preceded it, where (for example) we had $(5^{32} \bmod 7) \equiv (5^{16} \bmod 7)(5^{16}\bmod 7) \pmod 7$.
Essentially it is the same property that you are probably familiar with from modular arithmetic in general. For example, consider calculating $(20\times 15) \bmod 7 $. We can take the $\bmod 7$ value of each: $20 \equiv 6 \bmod 7$ and $15 \equiv 1 \bmod 7$ - and use those values to calculate the result $(6 \times 1) = 6 \equiv 6 \bmod 7$. And to show that is truly the $\bmod 7$ value of the original multiplication, we can drop back into the $20=7k+6$ type representation and prove out that all the multiples of $7$ can be ignored in the multiplication process. And if we want to in this case, we can even check that $300-6$ is indeed divisible by $7$.
So all we're looking at there is a standard property of modular arithmetic - the congruence classes multiply together consistently.
All numbers $n$ such that $n \equiv k \bmod m$ are in the same congruence class $\bmod m$ . For example, $\{2,9,16,23,30,37, \ldots\}$ are all in the same congruence class $\bmod 7$, identified by the non-negative member of the class less than than the modulo number - in that case, $2$. Still working modulo $7$, if we multiply any member of congruence class $2$ by any member of congruence class $4$, the answer will be in congruence class $1$.
The first and second case clearly work out, since $6789$ and $1000$ are co prime, so one can solve the given equations simultaneously.
If $x \equiv 32 \mod 1000$ then $x$ is a multiple of $8$, since $x = 1000k + 32$ so it is a sum of multiples of $8$.
However, $9876 \equiv 4 \mod 8$, so for any $x = 9876k + 54$ , it leaves a remainder of either $2$ or $6$ when divided by $8$, so it is never a multiple of $8$, so the third case does not work out.
On the other hand, the fourth case does work out, since if $x = 1000k+32 = 9876l+44$ then one may transpose and divide by four to get $250k - 2469l = 12$, and this can be solved since $250$ and $2469$ are coprime.
Hence, $1,2,4$ are solvable while $3$ is not.
A short note
More precisely, suppose you are trying to solve two simultaneous congruences, say $x \equiv a \mod b$ and $x \equiv c \mod d$. Then, write as the conclusion, $x = a+bk = c + ld$.
Therefore, rewrite this to get $ld - bk = a-c$. That is, we want to find integers $k,l$ such that $ld - bk = a-c$.
In conclusion, the question is the following: can $a-c$ be expressed as a linear combination of $b$ and $d$? For this question, Bezout's lemma gives a very clear answer : it can, if and only if $a-c$ is a multiple of the greatest common divisor of $b$ and $d$.
Therefore, all you need to do, is to check that $a-c$ is a multiple of the greatest common divisor of $b$ and $d$!
For example, in the first two parts, $(1000,6789) = 1$, and $a-c$ is a multiple of $1$ always, so the answer is yes.
In the latter two parts, we have $(1000,9876) = 4$, so it is enough to see that $a-c$ is a multiple of $4$. In the first case, $54 - 32 = 22$ isn't a multiple of $4$, while in the second case $44-32 = 12$ is.
This short note provides a complete answer to the kind of question you have been asked. It can also be extended to three or more congruences.
Best Answer
I'd say you are right and the video is wrong. For instance, we could have $k=19$, which can't be written as $k=2T$ for an integer $T$.
By the way, a possibly simpler approach to the whole thing is to note that $15\equiv 1 \pmod{7}$.
So $2\equiv 15l\equiv l \pmod{7}$.