How did the people know who the next Imam was? How did the Imams(as) announce themselves as they don't receive revelation from Allah(swt) so how do they know they are the next imam?

The prophet received the revelation from Allah and had all of their names mentioned. There are many narrations to this regard and an especially famous one which Jabir Ibn Abdullah Ansari narrated.