Yahoo didn't always get it right when it bought companies, but its most massive mistake from an investment perspective was rejecting Microsoft's $45 billion takeover bid in 2008.
That offer is about $4 billion more than what Yahoo is worth today.
After Yahoo rejected that offer, Microsoft came back with an even more ludicrous offer (with 20/20 hindsight): $20 billion for Yahoo's search business. Yahoo said no to that offer too. Yahoo's share of the search market has been cut in half since then, and its annual search revenue is less than $2 billion. So...
A deal between the companies kinda-sorta got done anyway. In 2010, Yahoo essentially gave up on search, handing the keys over to Microsoft to serve up Bing search engine results on its websites. Yahoo pays Microsoft a small percentage of the revenue from ads served on those pages.
"Sometimes, you're lucky," former Microsoft CEO Steve Ballmer said about the failed takeover bid in 2011.