Anthony Kennedy announced his retirement from the Supreme Court in the summer of 2018, at the age of 83. He did so knowing that a Republican President would pick his successor, and the Senate was in control of the Republican Majority Leader Mitch McConnell.
Democrat Harry Reid was Senate Majority Leader for the first six years of the Obama Presidency. In 2013 and 2014, the last two years in which Reid controlled the Senate Calendar, Ginsburg was 80-81 years old. Had she announced her retirement she likely could have told Obama who she wanted to replace her, and I’m guessing he would have acceded to her request. //
Justice Ginsburg sacrificed that opportunity so she would continue to write dissents on cases of interest to her since she was almost certainly going to remain in the losing minority on most such cases. //
One supposition is simply that she was confident Hillary Clinton would win in 2016, and she wanted the arc of her history as a Justice to be completed by having the first female President of the United States appoint her replacement to the Supreme Court. That would have made a nice ending to the movie “On the Basis of Sex”, which was a biographical account of her efforts as an attorney to extend the protections of the 1964 Civil Rights Act to women.