Aragorn and Gandalf put a lot of effort into tracking down Gollum. When they had him, they handed him over to the elves of Mirkwood for safekeeping - and those elves promptly lost him. Or did they? We only have Legolas' word for that, after all.
Consider a different scenario. Thranduil interrogates his prisoner (which we know he would do - he does the same to Thorin's Company) and discovers that he once had a Ring of great power. Thranduil may not be one of the Wise, but he surely knows a little about the Rings - enough to guess that Gollum's Ring was one of the Great Rings (though not necessarily which - it could be from the Seven, after all). To Thranduil, this is significant news. Bear in mind that there are four significant Elven domains in Middle-earth. Thranduil knew Galadriel back in Doriath (probably), and knows that her powers are significantly greater now than they were then - she can slow down time in Lorien! - so he can guess that she has a Ring. Elrond, too, has a sudden, unexplained shift in his past - from herald to healer. And it doesn't take much thought to figure out that the current head of Gil-Galad's former kingdom, Cirdan, would probably have any Ring Gil-Galad once owned. So (while he's actually wrong) Thranduil is sure that the other three Elven-Lords are Ringbearers. Someone is being left out - the same person as always - Thranduil. But now there is another Ring in play, one with no real owner - one that Thranduil could claim for himself.
He also learns that the Ring was stolen from Gollum by 'Baggins' - a name he would certainly recognise, since the Battle of the Five Armies wasn't all that long ago. Thranduil knows that Bilbo came from somewhere out west - though not where. He threatens Gollum, bribes him - anything, really, in an attempt to get him to go after the Ring for Thranduil. And Gollum agrees. Thranduil arranges his 'escape', and Gollum heads westwards - just as Thranduil told him to.
Is Legolas in on the plan? If he does know, then he must have been following Gollum - until he lost him near the Misty Mountains. He assumed the creature had crossed the range (not realising he had turned south, to Moria), and followed, winding up in Rivendell - just as the Ring Itself arrived! What a coincidence!
But then, knowing what the Ring really was - and knowing that Gollum was after it, following or pretending to follow Thranduil's instructions - Legolas abandons the plan. He joins the Fellowship to protect Frodo from Gollum - and from his father.