Electrons bouncing in a wire
Python 2, 148 142 87 bytes
n=input()
p=l=1
t=1
h=2
while t!=h:
 if p==l:t,l,p=h,0,p*2
 h=h/2^h*2%2**n;l+=1
print l

Uses Brent's cycle detection algorithm, and thus actually runs fast.

I have also written an animation in Python (both 2 &amp; 3 work). It needs pyglet to run. You can view the animation by running:
python -m pip install --user pyglet
curl -s https://gist.githubusercontent.com/orlp/f32d158130259cbae0b0/raw/ | python

(Feel free to download the gist and inspect the code before running.) You can press the + and - keys to increase/decrease the n being visualized.

And finally, for those interested in exploring this number sequence further, here is a readable version (this was used to generate the test cases above):
# Brent's cycle detection, modified from wikipedia.
def electron_period(n):
    wire_mask = (1 &lt;&lt; n) - 1
    power = lam = 1
    tortoise, hare = 1, 2
    while tortoise != hare:
        if power == lam:
            tortoise = hare
            power *= 2
            lam = 0
        hare = ((hare &lt;&lt; 1) ^ (hare &gt;&gt; 1)) &amp; wire_mask
        lam += 1
    return lam