Elections matter, affecting even the appointment of judges, as the Merrick Garland nomination demonstrates.
The Constitution provides that the president "shall nominate, and by and with the advice and consent of the Senate, shall appoint . . . judges of the Supreme Court." Of course, we elect our presidents and our senators. And the results are such that at any given time we have a president and a Senate of the same party or we have a president of one party and a Senate of the other party. That is, we have either unified or divided government (ignoring the House, which has no role here). And whether we have one or the other, vacancies on the Court will always occur, the filling of which is governed by the appointments clause.
The relevant elections for the Garland nomination were those in 2012 and 2014. In 2012, President Barack Obama won a second term, and the Democrats kept control of the Senate. No vacancies occurred during the first half of Obama's second term. But it's fair to say that had there been a vacancy, the Senate Democratic majority would have swiftly confirmed the president's nominee, just as it did his first two, Sonia Sotomayor in 2009 and Elena Kagan in 2010.
In 2014, the Republicans captured the Senate, creating a divided government. So when Justice Antonin Scalia died in February, the terms of the appointments clause left nominating his successor to the president, a Democrat, and the decision to confirm the nomination (or not) to the Republican Senate.
In The Oxford Companion to the Supreme Court of the United States, Rayman L. Solomon observes that during periods of divided government, the Senate has been occasionally able "to muster the opposition to block a vulnerable" nominee. Rarely, however, has there been a divided government in which Republicans controlled the Senate and during which a vacancy occurred that a Democratic president undertook to fill. Indeed, you have to go all the way back to 1895 to find a similar situation. The Democratic president Grover Cleveland nominated Rufus Peckham, and the Republican Senate confirmed him six days later.