With the Mueller Report now in the can and in light of the information previously uncovered/released, James Comey, with a tip of the cap to Lisa Page, Peter Strzok and Andrew McCabe, apparently decided in early 2016 that Hillary Clinton would be the next President of the United States and took action, with the full weight of the FBI behind him, with that outcome in mind.
Perhaps concerned that Hillary Clinton's use of a private e-mail server for official government business would create a significant legal problem that would hinder the future President once elected, an investigation was undertaken to address this issue. Mr. Comey's protestations that this investigation wasn't predetermined is undermined by the facts now known:
(1) Mr. Comey, following the direction of Attorney General Lynch, publicly referred to this as a "matter" and not an "investigation";
(2) Potential witnesses/collaborators were granted immunity without being required to provide any information helpful to the "matter's" resolution;
(3) Physical evidence was permitted to be destroyed despite being under government subpoena; and
(4) the Attorney General engaged in a secretive meeting with Bill Clinton after Mr. Comey had drafted a report exonerating Mrs. Clinton for lacking intent, but before the FBI actually interviewed Mrs. Clinton to inquire as to her intent (disregarding the dubious legal argument that intent was even required).