Here is a good explanation of how an electronic HID ballast works
HID Ballast