The demonstrations erupted after the arrest of the mayor of Istanbul Ekrem Imamoglu, the main political rival of President Recep Tayyip Erdogan.