Days of Future past will bring together "first class" the prequel movie about how Xavier and Magento came to be, and the Original Trilogy of films. Xmen Origins: Wolverine is a prequel as well of the Trilogy, setting up how Wolverine came to be. The movie "The Wolverine" is a sort of sequel to "Last Stand", but a prequel to "Days of Future Past." The latter mentioned is the true sequel to Xmen 3, "Last Stand."
The answer to the smiling, lays in the movie coming, 4th in the main story line, Days of Future Past. How professor X actually remained alive. Basically, it's as everyone said. There was a scene where professor X was lecturing his students regarding mutant ethics, speaks of the ability to transfer human consciousness into the body of a brain dead man in comatose. Mentioning that it raises serious concern (against ethics) even of that transferred consciousness was one of a father of 4, dying of cancer.
I believe professor Xavier was smiling, because the irony of it, was he went against his own ethical nature, and saved is own hide by transferring his consciousness into this patient aforementioned.