The head of Peru’s election authority was heckled by protesters after announcing his resignation.