1+x^n+x^m+x^(n+m) and 1+x+x^3+x^4
1+x^3 and 1+x^n
1-x^4 and 1-x^2n
If you are looking for more than the Factor function, please explain. Otherwise, this just sounds like homework.
In[2]:= Factor[1+x^n+x^m+x^(n+m)] m n Out[2]= (1 + x ) (1 + x )