It looks like a line is solvable if and only if
there is an odd number of heads in the line
and the strategy to solve the puzzle is to make sure
that whenever you take away a head, the remaining sub-lines each have an odd number of heads.
I'm on mobile right now and can't type a rigorous mathematical proof; moreover, two other users seem to be doing this so I'm going to spend that time upvoting their answers instead :)