Spoilers, obviously, since this concerns the end of the Negima manga.
There were many confusing aspects of the ending of the Negima manga. Many, many confusing aspects. For a series that started out as Harry Potter crossed with Love Hina, it's amazing how many were the confusing aspects of the ending.
Nagi's appearances towards the end were possibly the most confusing. In 334th Period at the end of Volume 36, the group defeats the Averrunci, only to find that their leader, in the black robe, is apparently Nagi. He tells Negi: "Kill me. Then it will all be over…I'll be waiting" (KC USA translation), then disappears.
In Volumes 37 and 38, we go through the wrap-up to miscellaneous other plots, and it seems that no one says anything at all about Nagi, as the focus is mostly on Asuna. Then, in Volume 38, 355th Period, the story skips ahead seven years to the day of the Ala Alba reunion. And there's Nagi, sitting right there drinking tea with Albireo, Rakan, Eishun, and Evangeline. Nodoka, Yue, Makie, and Ku Fei are surprised to see him, but Konoka and Setsuna are just surprised to see him up and about, and make some remarks about his health.
What happened? Is there any supplemental material that explains how we went from the events of 334th Period to what we see in 355th Period? I read a blog saying there was some kind of legal issue going on at the time Akamatsu finished Negima, which may have led him to finish it early. Did that have anything to do with this? The entire story began with Negi wanting to find his father, so it seems pretty odd to go through 37 volumes of material, set up the story where'd he'd finally accomplish this goal, and then totally skip it.