The only solution is f(x)=(−1)x.
To prove this, let's first consider the case n=1.
f(x)+2f(1−x)=(−1)x+1.
By replacing x with 1−x, we have
f(1−x)+2f(x)=(−1)x.
Hence, f(x)=(−1)x. Also, we can check this is a solution for n=1.
For general n, we can assume the following proposition: The one and only solution of
k=0∑2n−1−12r(k)f(k+(−1)kx)=(−1)x+n−1
is f(x)=(−1)x. Now, we're going to prove it's also true for n. Let
g(x)=−f(x)−2f(2n−1−x),
then
2r(k)g(k+(−1)kx)=−2r(k)f(k+(−1)kx)−2r(k)+1f(2n−1−k+(−1)k+1x)=−2r(k)f(k+(−1)kx)−2r(2n−1−k)f(2n−1−k+(−1)2n−1−kx).
Here we've used the property of r(k), r(k)+1=r(2n−1−k) for all 0≤k≤2n−1−1.
Next, by summing over k, we can get
k=0∑2n−1−12r(k)g(k+(−1)kx)=−k=0∑2n−12r(k)f(k+(−1)kx)=(−1)x+n−1.
Therefore, g(x)=(−1)x, and hence f(x)=(−1)x can be derived from the way similar to the case n=1. Also, f(x)=(−1)x satisfies that −f(x)−2f(2n−1−x)=(−1)x=g(x), hence it is a solution.