australia
The High Court of Australia sitting as the Court of Disputed Returns has the power under Part XXII of the Commonwealth Electoral Act 1918 to try a disputed return or refer the dispute to the Federal Court for them to try. The petition must be filed with the court within 40 days of [some complicated stuff which basically boils down to the point at which the election became final]. The court is required to make its decision "as quickly as is reasonable in the circumstances."
The powers of the court are detailed in s360 and include:
(v) To declare that any person who was returned as elected was not duly elected;
(vi) To declare any candidate duly elected who was not returned as elected;
(vii) To declare any election absolutely void;
In practice (v) & (vi) go together as in "he's out, she's in" and are the usual result where a candidate is invalid or has acted against the law.
(vii) is less common and usually relate to irregularities in the vote itself - for example, the 2013 Senate election in Western Australia was voided when 1,375 ballot papers were lost (out of almost 1.35 million) and a new election was held in 2014. It is worth noting that because the Senate is elected by proportional and preferential voting, small changes can affect the outcome.