The ending of Shankar and Vikram's mega entertainer Anniyan is open for interpretation in different ways.
I would say that the evil Vikram took over the softer personality - in order to be released from prison - because that was the only way he could continue to fulfill his goals. It makes sense, a non-resurgence of the evil side would have him released and then he would be a free man. This, is a very sinister and hair raising plot.
Another opinion is that he still wasn't fully cured, and he is still in his old state, with the occasional recurring disorder. In my opinion this does not seem to make a fit ending, but the discussion continues....
Edit1: In response to Blany's comment I will detail my first suggestion.
All through the film the Anniyan appears when something bad is happening. In the end, the guy who was drinking is missing and Sada sees Vikram smiling, in good character standing by the door. When she hugs him, Vikram suddenly becomes the Anniyan and throws the drunkard off the train. So there is a sudden change in character, with the intent of not revealing to other persons the goings on. Hence the evil Vikram has taken over the good Vikram and appears at the evil character's own willing.
Though, if Blany is right, this may not be psychologically possible, I would love to believe it could happen. It makes a fantastic ending.