I'm looking at some examples that I have and I follow them until I get to the result where something like -2*(-1 + cos(Pi*m)) / Pi*m^2

is simplified to -2/Pi*m^2 ((-1)^m - 1)

Why does the cos(Pi*m) turn into (-1)^m?

And if this was sin instead what would happen?

I may be forgetting some old simple rule that I should have learnt