As lawmakers of both major parties demanded during a highly contentious congressional hearing, she stepped down over security failures that allowed a gunman to scale a roof and open fire at a campaign rally.