Yes, the pattern holds for every prime greater than 3.
Claim: If p > 3 is prime, then p² − 1 is divisible by 24.
Proof: Factor it as p² − 1 = (p − 1)(p + 1). Since 24 = 8 × 3 and gcd(8, 3) = 1, it's enough to show the product is divisible by 8 and by 3 separately.
Divisibility by 8. Since p is prime and greater than 2, it is odd, so p − 1 and p + 1 are consecutive even numbers. Of any two consecutive even numbers, exactly one is a multiple of 4 (they're 2k and 2k + 2, and one of k, k + 1 is even). So one factor is divisible by 4 and the other by 2, and the product is divisible by 4 × 2 = 8.
Divisibility by 3. Among the three consecutive integers p − 1, p, p + 1, exactly one is divisible by 3. It can't be p, because p is a prime greater than 3. So 3 divides p − 1 or p + 1, and therefore divides the product.
Conclusion. 8 and 3 both divide (p − 1)(p + 1), and they're coprime, so 24 divides p² − 1. That means p² ≡ 1 (mod 24). ∎
Sanity check with the next primes: 13² = 169 = 7·24 + 1, and 17² = 289 = 12·24 + 1.
This also shows the result doesn't really need primality. It holds for any integer coprime to 6, and primes greater than 3 are just the most famous examples.
Yes, the pattern holds for every prime greater than 3.
Claim: If p > 3 is prime, then p² − 1 is divisible by 24.
Proof: Factor it as p² − 1 = (p − 1)(p + 1). Since 24 = 8 × 3 and gcd(8, 3) = 1, it's enough to show the product is divisible by 8 and by 3 separately.
Divisibility by 8. Since p is prime and greater than 2, it is odd, so p − 1 and p + 1 are consecutive even numbers. Of any two consecutive even numbers, exactly one is a multiple of 4 (they're 2k and 2k + 2, and one of k, k + 1 is even). So one factor is divisible by 4 and the other by 2, and the product is divisible by 4 × 2 = 8.
Divisibility by 3. Among the three consecutive integers p − 1, p, p + 1, exactly one is divisible by 3. It can't be p, because p is a prime greater than 3. So 3 divides p − 1 or p + 1, and therefore divides the product.
Conclusion. 8 and 3 both divide (p − 1)(p + 1), and they're coprime, so 24 divides p² − 1. That means p² ≡ 1 (mod 24). ∎
Sanity check with the next primes: 13² = 169 = 7·24 + 1, and 17² = 289 = 12·24 + 1.
This also shows the result doesn't really need primality. It holds for any integer coprime to 6, and primes greater than 3 are just the most famous examples.