Democrats have won control of Congress in a widespread repudiation of President Donald Trump and the Republican Party.