It’s never been about the best candidates. That’s a story for school children. In reality it’s all about who is connected to who, who makes favors for who etc.
And naturally you need to be rich, which means you are already connected to a web of individuals who you owe favors, or are expected to satisfy in different ways.
In Biden’s case a major factor is his catering to the Israel lobby his whole career. They really disliked Obama since he was known to attend pro Palestine events and apparently knew what the deal was. Biden as his VP pick was basically his signal to donors that he would govern like an establishment Democrat, and that he did.