South African President Jacob Zuma has resigned "with immediate effect" after facing a no-confidence motion from his party, the African National Congress (ANC).