One vacancy in 1968 did not actually occur due to the way the resignation letter was phrased. A candidate was nominated nonetheless but a Republican filibuster prevented the Democratic Senate majority from confirming the candidate.
Wikipedia has an entire article on the Appointment process for judges of the Supreme Court including an entire section concerning nominations in the last year of a presidency. However, it only considers nominations made in the last year of the second term for a president who served two terms; it doesn’t, for example, mention Lincoln’s nomination of Chief Justice Chase in December 1864 which was the last year of Lincoln’s first term. On the other hand, the list of justices of the Supreme Court only mentions those who took office.
Thus, I decided to compile the following list of vacancies that occurred in the last 15 months of a president’s term and tried to find out when the replacements were nominated and what happened. I also started this list with the end of J. Adam’s term in 1800 as Washington wished to be nonpartisan and thus it doesn’t make sense to speak of partisanship during his tenure.
15th December 1800: resignation of Chief Justice Ellsworth
Vacancy occured after the 1800 election, in which the Federalists lost the White House and Senate to the Democratic-Republicans. Before Jefferson took office, Adams nominated Jay (who declined) and Marshall; both were confirmed by the Senate in the lame duck period (Marshall’s confirmation occurring on 27th January 1801).
26th January 1804: resignation of Justice Moore
Justice Johnson was nominated by Jefferson on 22nd March and confirmed by the Senate on 7th May the same year. In November, Jefferson was reelected and the Democratic-Republicans held control of the Senate.
25th August 1828: death of Justice Trimble
The presidency of J. Q. Adams was a somewhat turbulent time; arguably, Adams never had a true majority in the Senate. While elected as a Democratic-Republican, the party split into Jacksonians and Anti-Jacksonians during his tenure; the former were a majority but the latter supported Adams.
Adams did not attempt to nominate a successor to Justice Trimble until after the election which he lost to Jackson. The Senate voted to not proceed with voting on Adams’ candidate. After Jackson’s inauguration, he nominated Justice McLean who was confirmed by the Jacksonians/Democratics (who held onto the Senate) shortly after.
25th February 1841: death of Justice Barbour
The Democratic Party had lost all control in the elections of 1840 (presidency, House and Senate) to the Whig Party. Outgoing president Van Buren nominated Justice Daniel, the successor, on 26th February and the Senate confirmed him on 2nd March just before the new term.
18th December 1843: death of Justice Thompson; and
21st April 1844: death of Justice Baldwin
The nominations by president Tyler to fill the vacancies of Justice Thompson and Justice Baldwin is the single largest block in the table of the Wikipedia article. Tyler took office after president Harrison passed away. Although he was elected vice president on the Whig Party ticket in 1840, he was expelled from the party and thus an independent at the end of his tenure. In total he nominated eight people. Four of those nominations were during his lame duck session. Tyler was not on the ballot for re-election but the Whig Party lost Senate control in 1844 (and Democrat Polk won the presidency). Only one of his nominations was confirmed by the Senate, the second seat remaining vacant seat was filled by Justice Baldwin, over a year into the Polk presidency.
19th July 1852: death of Justice McKinley
President Fillmore of the Whig Party nominated three people to fill this vacancy but the Democratic-controlled Senate acted on neither. The last two were made during his lame duck session, after his party was defeated by Democrat Pierce in the 1852 election. The Democrats held the Senate and went on to confirm Pierce’s nomination within a month of the new session.
31st May 1860: death of Justice Daniel
Democratic president Buchanan nominated J. S. Black in his last month in office. He was not on the ballot in the 1860 election and famously the Republican Lincoln would take the White House. The Democratic Party declined to vote on Buchanan’s nomination; Democrats had held the Senate in 1860. President Lincoln’s nominee would be confirmed by the Senate.
12th October 1864: death of Chief Justice Taney
The successor, Chief Justice Chase, was nominated after the election but before the next terms of president and Senate. However, Congress and White House were held by the Republicans.
28th November 1872: retirement of Justice Nelson
As above, the successor Justice Hunt was nominated by re-elected Republican president Grant and confirmed by the re-elected Republican Senate majority between the election and the new term.
14th December 1880: retirement of Justice Strong; and
24th January 1881: retirement of Justice Swayne
Both vacancies occurred after the 1880 elections in which the Republicans held the White House and gained the Senate. The Democratic majority confirmed outgoing president Hayes’ nomination of Justice Woods but did not act on the second vacancy. After the transition of power to the Republicans, president Garfield’s nomination was confirmed rapidly.
23rd March 1888: death of Chief Justice Waite
Despite the Republican party holding the Senate during Democratic president Cleveland’s first term, Chief Justice Fuller was nominated on 30th April 1888 and confirmed on 20th July 1888. In November, Republicans would hold the Senate and gain the Presidency.
22th January 1892: death of Justice Bradley; and
23rd January 1893: death of Justice L. Q. C. Lamar
Both vacancies occurred with a Republican-held White House (president Harrison) and a Republican Senate majority. The 1892 vacancy was filled by Justice Shiras Jr before the election, the 1893 vacancy by Justice Jackson in the lame duck period. Democrats gained the presidency and a Senate majority in 1892.
2nd January 1916: death of Justice J. R. Lamar; and
10th June 1916: resignation of Justice Hughes
Both nominations by President Wilson (D) occurred well before the election; both candidates were confirmed by the Democratic senate majority in June/July 1916. The Democrats would hold presidency, House and Senate in the November election.
5th January 1925: retirement of Justice McKenna
The successor, then Justice Stone, was nominated by Republican president Coolidge and confirmed by the Republican Senate majority between election and the beginning of the new term. Those two and the Republican House majority were held in the 1924 election.
12th January 1932: retirement of Justice Holmes Jr
Republican President Hoover nominated Justice Cardozo and the Republican Senate majority confirmed him on 24th February 1932. In November, the Democrats would take presidency and Senate in a landslide.
Inauguration Day moved from 4th March to 20th January
16th November 1939: death of Justice Butler
This vacancy barely makes the 15 month-cutoff and it was swiftly filled by Roosevelt’s (D) nomination of Justice Murphy whom the Democratic Senate confirmed on 16th January 1940. Democrats held onto Congress and presidency in the November 1940 election.
15th October 1956: retirement of Justice Minton
This is an interesting case, as Republican president Eisenhower nominated a Democratic replacement, Justice Brennan Jr. This was a recess appointment on 16th October, so his tenure on the Supreme Court began immediately but would expire if the Senate had not confirmed it by the end of the next session. The Democratic Senate majority (which had been held in the 1956 election; Eisenhower was also re-elected) confirmed him on 19th March 1957.
12th November 1975: retirement of Justice Douglas
Another event barely making the cut, but partially noteworthy because the Democratic-controlled Senate confirmed Justice Stevens (nominated by Republican president Ford) unanimously in December 1975. After the 1976 election, Democrats gained the presidency and held the Senate.
13th February 2016: death of Justice Scalia
The Republican-controlled Senate declined to act on the nomination put forward by Democratic president Obama. After the 2016 election, the newly elected Republican president Trump appointed a successor who was confirmed by the Republican majority.
18th September 2020: death of Justice Ginsburg
Republican President Trump nominated Amy Coney Barrett who was confirmed by the Republican Senate majority on 27th October of that year.
The Wikipedia article also mentions the 1968 case of Chief Justice Warren offering his resignation to Democratic president Johnson, effective once a successor had been appointed. While the Democratic Party had a Senate majority in 1968, the Republican minority filibustered all attempts to vote on the designated succession. The Republican Nixon won the presidency in the 1968 election. Warren declined to withdraw his resignation letter and president Nixon nominated Chief Justice Burger to succeed him in June 1969. Despite the Democratic Party still holding a majority in the Senate, Burger was confirmed 74-3.
Some may want to look deeper into the numbers but I think the only clear conclusions that can be drawn are:
It bears mentioning that a plurality of vacancies could be filled even with a split government. However arguably, there have only been four vacancies since the Second World War (plus the half-vacancy in 1968), so most of the precedents are from before what is commonly known as the party realignment.