An extended comment, not a definitive answer...
Treating this sum as just a mathematical concept rather than WolframLanguage code,
Sum[Cos[x - 2 n Pi/NN]^m, {n, 1, NN}]
I suspect that there are certain values of NN for which the sum is undeterminable. But there may be a general solution, equivalent to (3 NN)/8 that works for "almost all" integers. I further suspect that WolframLanguage implementation of Sum applies some heuristics to arrive at that general solution. And so, I'm not convinced that we're seeing an actual bug so much as a good faith attempt to produce the "best" answer.
As for the expression being WolframLanguage code, your expectation is simply wrong. Starting with
sum1N[m_] := Sum[Cos[x - 2 n Pi/NN]^m, {n, 1, NN}]
notice that x, n, and NN are unbound. That is, sum1N[4] will be evaluated without substituting any values in for those variables. One might expect that this simply wouldn't evaluate at all, but again, I suspect that Sum is implemented with rules that happen to handle this case for most inputs.
So, when you later substitute in values for x and NN and show that it should be
Cos[1.0 - 2 Pi/4]^4 + Cos[1.0 - 2*2 Pi/4]^4 + Cos[1.0 - 2*3 Pi/4]^4 + Cos[1.0 - 2*4 Pi/4]^4
that is a completely different calculation. If you had defined it this way,
sum1N[m_] := Sum[Cos[1 - 2 n Pi/4]^m, {n, 1, 4}]
then you would get exactly what you'd expect. In this definition, Sum doesn't need to apply any heuristics, it can just do the four iterations directly.
Furthermore, going back to
sum1N[m_] := Sum[Cos[x - 2 n Pi/NN]^m, {n, 1, NN}]
you should realize that this is a very strange formulation. NN is the max value for the iterator n, but it also shows up in the body of the sum where it cannot possibly be bound to anything. Sum has the same structure as Table so replace Sum with Table to see what I mean:
sum1N[m_] := Table[Cos[x - 2 n Pi/NN]^m, {n, 1, NN}]
Now, if you try to evaluate sum1N[4], you'll get an immediate error message and the expression will fail to evaluate. Again, one might reasonably have expected Sum to do the same thing, but Sum was trying to be "nice" by applying its extensive set of heuristics to give you something rather than nothing. But it's up to you to make sure that you provide meaningful inputs. It's the whole "garbage in, garbage out" thing.
Sum[Cos[x - 2 n Pi/NN]^m, {n, 1, NN}]andSum[Cos[x - 2 n Pi/NN]^m, {n, 1, NN}, Assumptions -> m \[Element] PositiveIntegers]return the inputs in 13.3.1 on Windows 10. – user64494 Nov 15 '23 at 19:13