How do quasars form?
When a supermassive black hole at the centre of a galaxy has enough material to form a continuously supplied accretion disk.
A quasar forms, or ignites, when there is an abundant supply of gas and dust around a supermassive black hole at the centre of a galaxy. The material (the gas and dust) starts spiralling into the black hole to form an accretion disc.
As additional material falls into the accretion disc it gets heated by gravitational effect of the black home and friction with other particles in the accretions disc. This results in a massive output of energy which we call a quasar.
Quasars are thought to occur in young galaxies which have a lot of material to fuel a quasar. These quasars "go out" when the material supply is exhausted.
A quasar can reignite is sufficient material becomes available, for example as the result of a collision with another galaxy.
The quasars we are observer are very distant galaxies as they existed billions of years ago as they are billions of light years away.