At an end point the ball need potential energy(energy from inside) to keep on going and it also need kinetic energy(motion) which would result it in keep on moving. If it is attached to a rope and you swing it and it reaches one side to come back it will collect energy from itself and then boost it into kinetic energy.