A planet at any given distance orbits its star in a nearly circular orbit. The escape speed of a planet in a circular orbit is 1.414 times its circular orbit speed. This means that if the star suddenly ejected half of its mass outside the orbit of the planet, the speed of the planet would now equal the escape velocity of the remaining mass of the star. The planet would be ejected from the system. If the star ejected less than this amount of mass, the orbit would become elliptical. Such large mass ejections are more likely to occur when some stars go supernova. As stars like our sun evolve into red giants, they loose some of their mass, and may in fact loose up to half their mass as they form planetary nebulae. Planets around these stars are likely to find life very uncomfortable as their stars age.
When a supernova occurs in a star system with several companions, the system can become unbound and the stars ejected into interstellar space at high velocity. An example of this is the 3 'runaway stars' 53 Arietis, AE Aurigae and Mu Columbae. They have large proper motions, and when you trace back on the sky their paths, they arrive at a common point located in the constellation Orion. It is believed that about 3 million years ago, one of the members of a 4-star system went supernova and these three stars were ejected into space at a velocity equal to their orbital speeds.