Pay attention to science news and you might have come across a couple of interesting titbits.
First, and being well reported, is the isolation of a 'rogue planet' as part of a group of young stars. Given its location and the fact that it is a gas giant a few times bigger than Jupiter, it's probably a very small failed star.
Far more intriguing is the idea that a rogue planet forms around a star and then, well, leaves. Another group may have found as many as ten Jupiter-sized rogues. That seems unlikely for the 'nomad planet' theory, and I suspect many of these wandering gas giants are failed stars.
What could, though, cause a planet to be ejected from its home solar system? The answer lies in planetary formation.
Planets form when matter around a star coalesces, thanks to gravity, into lumps of varying sizes. These lumps tend to attract other lumps during the early 'bombardment' phase, when objects are whizzing around all over the place. If two big lumps come too close to each other late in this era, one or both may be gravitationally ejected, sailing out into interstellar space. If the system is in a cluster with other systems, the rogue planet may be captured by another star, resulting in weirdness such as orbits that don't match the plane of the rest of the system, planets orbiting in the wrong direction, etc. A lot of rogue planets, however, will simply vanish into the darkness.
Could a well-developed world end up as a rogue? Do we have to worry about being knocked out of orbit as a possible end of the world scenario?
The answer is...possible but very unlikely. The most likely cause of 'late' rogues would be an encounter with an extremely massive object as the solar system orbits the galactic center. There's some evidence that if a double star system gets too close to the black hole that acts as our galaxy's gravitic 'anchor', one of the stars might slingshot off at massive speed. Planets in the system might also be ejected.
One possible scenario would be a collision between two solar systems. Two stars that passed too close to each other could 'trade' planets and planets could easily be ejected...or destroyed. Isaac Asimov's classic late novel 'Nemesis' deals with this idea. Another idea for a good story might be a less close passage...the two systems not actually colliding, but a habitable planet temporarily coming close enough to be reached without FTL. Would you colonize it or not?
The chances of such a collision are currently low. However, they might increase as we pass through a major spiral arm in the course of our orbit around the galaxy. How often does this happen? About every 100 million years, with a transit time of 10 million. Probably not anything to worry about.