Alan777:
PaulS, do you think it detaches the servo after 100 as a safety measure to avoid the sketch running eternally or something like that?
The sketch will run forever, regardless of whether the servo is detached, or not.
I don't know if detaching the servo saves energy, or not. I rather doubt it, since the motor in the servo and the battery have no idea whether the Arduino has attached the servo or detached it.