Ferromagnetism in the vicinity of Lifshitz topological transitions