This is an excellent article outlining what Putin (may have) expected to gain by hacking the DNC and meddling in the election AND (more importantly) why we (US intel) so easily came to know about it.
"WHAT PUTIN WAS UP TO" (Paul Mirengoff, Powerline, 19 July 2018
Having worked in this area...