The last page is k, the first is 1, so the average page is (k+1)/2.
If there are two middle pages, then their sum is k+1.
But there is only a clear set of middle pages if k is even. If k is odd, then the middle page is (k+1)/2. The page before it is (k-1)/2 and the page after it is (k+3)/2. Depending on which 2 you pick as the "middle" pages, their sum is either k or (k+2).
Final answer: k+1 if k is even,
k or k+2 if k is odd
And all of this assumes that we are using the word "page" consistently. I choose not to say that a book with 50 sheets has page 49 and 50 on one of the middle sheets and 51 and 52 on the other, for a total of 202.
Edited on November 5, 2018, 10:06 am