This question already has an answer here:
- How can Professor Xavier be alive? 6 answers
The X-men time line is
- Wolverine Origins(2009)
- X-men: First Class(2011)
- X-men: Days of Future Past(2014)(Past Section)
- X-men (2000)
- X-men 2 (2003)
- X-men: The Last Stand(2006)
- The Wolverine(2013)
- X-men: Days of Future Past(2014)(Future Section)
Original Timeline is 5,6,7,8.
Then Wolverine is sent back in time in 9.
But before 9, at the ending of 8, Wolverine meets Xaviers(who was turned to nothing in 7) and Magneto(Who lost his powers in 7)
Magneto may have got back his power maybe through sheer will, or maybe the serum's effect wasn't permanent. But how did Xaviers came back? He only says to Wolverine that he is not the only one with special powers. But its never revealed how or who brought him back.