For the sake of brevity, let's assume (N-1)(N+1) = x.
1. If N is not a multiple of 2, then both N-1 and N+1 are going to be even, so x will be the product of two even numbers, making it a multiple of 4. However, this is not enough to establish the remainder of x/24. Consider x = 16 and x = 20: we get different results for the two values.
2. If N is not a multiple of 3, then either N-1 or N+1 will be a multiple of 3 (there's that age-old rule that out of three consecutive numbers, one of them is a multiple of 3). This doesn't help with 24, however. Take x = 6 and x = 9: they are both divisible by 3, but yield different remainders when divided by 24.
If you put both statements together you get that N is not even and not a multiple of 3. The LCM f 2 and 3 is 6 and all numbers can be expressed according to the remainder they yield when divided by 6 like so:
6k - can't be N, since N is not div by 2
6k + 1
6k + 2 - can't be N, since N is not even
6k + 3 - can't be N, since N is not div by 3
6k + 4 - can't be N, since N is not even
6k + 5
So, out of all the numbers out there, N can be either 6k + 1 or 6k + 5. But watch what happens to x:
a. N = 6k + 1
N - 1 = 6k
N + 1 = 6k + 2
x = 6k(6k + 2) = 12k(3k + 1) - x is obviously divisible by 12, but it will also be divisible by 24. This is because no matter what k is, 3k + 1 will be the opposite of it: if k is even, then 3k + 1 will be odd.
You may wonder how could this be: well, 3k + 1 = (k + 1) + 2k. Adding an even number (2k) to another number (k + 1) will always make the sum even or odd depending on k + 1.
So k(3k + 1) = 2p (where p is an integer) will always be even, since one of its components will be even and the other will be odd.
Finally, x can be rewritten as x = 12 * 2 * p = 24p. x is divisible by 24.
b. N = 6k + 5
N - 1 = 6k + 4
N + 1 = 6(k + 1)
x = (6k + 4)*6*(k + 1) = 12(3k + 2)(k + 1). The demonstration why (3k + 2)(k + 1) will always be even is similar to the one above, since in this case we have (k + 1) and (3k + 1) + 1 instead of k and 3k + 1 respectively.
So again x = 12 * 2 * r = 24r. x is divisible by 24.
IMHO, really, really hard demonstration, or at least the way it look a it. I'm really curious whether someone could come up with a faster way of doing this except number picking.