"Wilkins arrived in California in the 1899 where he found Sunnydale after the last slayer died there, which lay over the Hellmouth for demons to feed on on the promise of an Ascension. He became mayor of Sunnydale to keep an eye on everything, making sure nothing would interfere with his demon transformation plans, but remained out of the spotlight so as not to attract attention of any would-be interlopers.
After Mayor Wilkins achieved Ascension into a gigantic, snake-like pure-demon during Sunnydale High's graduation ceremony in 1999. Buffy lured him into the empty library, now filled with bags of dynamite. Rupert Giles then pressed the trigger that obliterated the Mayor and the school building.
The essence of the Mayor survived and possessed the bodies of dead animals and demons as well as vampires to get revenge on Buffy. In the process, he was responsible for the creation of Adam, when he possessed the corpse of a powerful demon (his earlier vampire body having been captured by the Initiative) and badly injured the then-human Adam. He also put Buffy's watcher Giles in the hospital, killed several of Buffy's former school mates and nearly killed Willow, In his final battle with Buffy in Faith's apartment, Buffy finally learned of his ghostly nature after decapitating his current body to no effect. Willow, with the assistance of Xander and Buffy, sent Wilkins to the next realm. There was no evidence that they ever discovered it was the Mayor who had been attacking Buffy, although Faith later told Angel in prison that she recalled the Mayor's ghost visiting her using the body of a dead bird while she was in her coma." (source)