Not to defend either Hillary or lawyers in general . . . but when you're a defense attorney, your job is to provide your client with the best defense possible. (In this case, the defendant was convicted--but it was a plea bargain deal.) I heard an interview with the prosecutor in the case in question. Hillary didn't even want to take the case, but the defendant specifically requested a female attorney, the judge assigned her to the case and would not let her off the hook.
As for polygraphs, the results are not admissible in court. Usually, it's more a question of beating the operator rather than beating the machine. CIA, for obvious reasons, has pretty good polygraphers. But when you consider that they missed Aldrich Ames, who spied for the Russians for a number of years, it's easy to see that lie detectors are far from 100% reliable.