Former Director of National Intelligence Jim Clapper, former CIA Director John Brennan and former FBI Director Jim Comey appear to have played critical leadership roles in carrying out this conspiracy and they may not have operated on their own. Almost certainly what they may have done would have been explicitly authorized by the former President of the United States, Barack Obama, and his national security team.
It must have seemed a simple operation for the experienced CIA covert action operatives. To prevent the unreliable and unpredictable political upstart Donald Trump from being nominated as the GOP presidential candidate or even elected it would be necessary to create suspicion that he was the tool of a resurgent Russia, acting under direct orders from Vladimir Putin to empower Trump and damage the campaign of Hillary Clinton. Even though none of the alleged Kremlin plotters would have expected Trump to actually beat Hillary, it was plausible to maintain that they would have hoped that a weakened Clinton would be less able to implement the anti-Russian agenda that she had been promoting. Many observers in both Russia and the US believed that if she had been elected armed conflict with Moscow would have been inevitable, particularly if she moved to follow her husband's example and push to have both Georgia and Ukraine join NATO, which Russia would have regarded as an existential threat.
Trump's surprising victory forced a pivot, with Clapper, Brennan and Comey adjusting the narrative to make it appear that Trump the traitor may have captured the White House due to help from the Kremlin, making him a latter-day Manchurian Candidate. The lesser allegations of Russian meddling were quickly elevated to devastating assertions that the Republican had only won with Putin's assistance.
No substantive evidence for the claim of serious Russian meddling has ever been produced in spite of years of investigation, but the real objective was to plant the story that would plausibly convince a majority of Americans that the election of Donald Trump was somehow illegitimate.