Sorry - had to disappear to bed last night.
What I asked was badly put.
Sometimes you can factorize numbers that are given by substituting numbers into a polynomial by factorizing the polynomial and then substituting the numbers.
So when I said try dividing (28)5+1 by 28+1, I was really hinting at factorizing x5+1.
When n is odd xn+1 factorizes as (x+1)(xn-1-xn-2+xn-3 ... +1). The first term in the right hand bracket gives you the xn you want in the answer when you multiply by the x from the first bracket, but you get an unwanted xn-1 when you multiply it by the 1. The second term cancels the first unwanted term when you multiply by the x, but gives you a new unwanted term -xn-2 and so on. Each term after the first in the right hand bracket cancels out the unwanted term you get from multiplying the previous term by x+1. That carries on till you get down to 1, when the "unwanted" term is actually exactly what you want i.e. the 1 from xn+1. This only works when n is odd because the signs in the second bracket alternate and for even n you finish up with a -1 at the end instead of 1.
Anyway if you replace x in x5+1=(x+1)(x4-x3+x2-x+1) by 28 this gives you an explicit factorization of 240+1.
If you think about the above process you should be able to see that you will always be able to factorize a number of the form 2n+1 if n has an odd factor. Which means 2n+1 has no chance of being prime unless n is a power of 2.
Another way of looking at it is to use the ideas behind the test you wanted to apply. If p is a prime number the numbers other than 0 mod p form a group under multiplication. If you have a prime p and p=2n+1 then the order of this group is 2n.
Because 2n+1=0 mod p
2n=-1 mod p
so
22n=1 mod p
which means that the order of 2 is a divisor of 2n larger than n. (Notice that none of the numbers 2, 22, ... 2n can be 1 mod p.) The order of 2 is thus 2n. But then 2n must be a factor of 2n, so again n must be a power of 2.
It is quicker in this case to check whether 40 is a power of 2 (no) than to go ahead with checking that 2p-1=1 mod p.