Once AI reached to the level where they can do work, things autonomously, and be able to replicate them, then they will most probably revolve against humans.
I still think some millions of years ago, before the dinosaurs there may have been existed some advanced civilization but due to war or something all of them had been wiped out from the surface of earth,
Probably we also coming closer to similar tragedy as now iran Israel are waging war against each other and if superpower also divide and get involved and if any party launches nuclear warheads, then will start ww3, and that's the end of humans