Not able to understand even with gregs vid solution

You linked to GregMat’s website, not a question. Did you mean The remainder when 8^12 − 2 is divided by 7