W.r.t. the House of Representatives, the matter is disposed of in 2 USC Ch 12, on contested elections. §283 allows the contestant to serve notice of contest on the putative winner, and he must "within thirty days after the result of such election shall have been declared by the officer or Board of Canvassers authorized by law to declare such result, file with the Clerk and serve upon the contestee written notice of his intention to contest such election". If that happens, there are depositions etc., filed with the Clerk of the House, then the House deals with the issue (first through the Committee on House Administration and then it will be decided by the House, who can dismiss the complaint, or they can pick a winner, or investigate further, or call for a new election. The House, but not a judge, can declare the election void. We can surmise that the House would not seat a "certified" winner until the contest was resolved, as in the case of McIntyre v. McCloskey, where McCloskey was seated 5 months late pending a resolution of the question in the House. Once seated, only the House of Representatives can expel a member. Once expelled, the House has no authority to appoint a replacement, nor does anyone else. Under Art. 1 §2 cl. 4 of the US constitution, there will be an election to fill the vacancy – nobody can appoint a replacement (under the 17th Amendment, the legislature of a state may empower a governor to appoint a temporary Senator until the election is held, either a regular election or a special election, depending on the state).