A light can only be turned on if there is a light next to it turned on. In how many ways can you turn on all the lights?

Let there be m sequences of consecutive lights which are turned off, and $a_i$ be number of lights of each sequence,$i\in\{1,...,m\}$.

If you watch only one sequence there is difference if the sequence is between two lightened lightballs or is at the end of row. If it is between then there is $2^{a_m-1}$ ways to choose order in which you will light them up, LRRLRR f.e. If it is on the end of row then there is only one way to turn them on going one by one.

Once you picked order of turning lights of each sequence you must decide order of the sequences you will turn a light from in each round. Number of it is $\frac{(\sum a_i)!}{\Pi (a_i!)}$

And total number is $\frac{(\sum a_i)!}{\Pi (a_i!)}\Pi (2^{a_j-1})$ where $j$ are indexes of the sequences that are in middle, so possibly without 1 or n.

In your example there are no sequences in the middle so you just have $\frac{(2+2)!}{ 2!2!}=6$

Here is an example which is more complicated: 0010001100001

So $a_1=2, a_2=3, a_3=4$ answer is $\frac{(2+3+4)!}{ 2!3!4!}2^{3-1}2^{4-1}$