This is an SN1 reaction, but the carbocation is special because it's allylic.
If the Br- nucleophile attacks the 3º resonance form, the 1,2 product is formed. (This is the product that would have formed if resonance was not involved.)
If the Br- nucleophile attacks the 2º resonance form, the 1,4 product is formed.
