When I plug my Arduino in via USB, it continuously disappears and reappears in the devices and printers menu (I'm using Windows 7 x64). The servo sweep sketch is loaded on it, but it's not running properly - instead of sweeping, the servo makes a small, jerky movement for about half a second, then disconnects. However, when I remove the servo from the circuit, the Arduino remains on. :~
99% certain you are powering the servo from the Arduino and it draws too much current and causes the Arduino to reset.
Servos (and other motors) should have their own power supply with the power supply ground connected to the Arduino ground.
...R
In particular you cannot power a servo from 5V USB ever - apart from risking
destroying your computer's motherboard (I wouldn't risk it), USB sockets supply
at most 0.5A - Pretty much every servo in existance takes more than that, some
substantially more.