As stated in the link provided by @Shadock, hydrogen peroxide, like many more other molecules, is subject to hindered internal rotation. When you rotate the two OH groups with respect to each other around the O-O bond, this requires a certain energy depending on the relative angle. In the eclipsed configuration (OH groups pointing in the same direction), it's easy to see that there must be a maximum in the potentiall due to the Paulli repulsion. In the anti-eclipsed configuration (both OH groups pointing in opposite directions) there is another maximum as you anti align the two dipoles of the groups. In between these maxima, you'll find a minimum and the potential can be expanded as a Fourier series in the relative bond angle
where $V_2$ and $V_4$ are related to the heights of the two barriers. If the barriers were infinitely high, the OH groups would act as a quantum harmonic oscillator in one of the potential minima. On the other hand, if the barrier were very small, the OH groups would rotate freely around each other. In the case of hydrogen peroxide, the eclipsed barrier is so high that the OH groups can hardly go over/through it. The lower barrier is a different story. It is high enough to support a few vibrational levels, but not high enough to prevent the OH groups from tunnelling through the barrier and as a consequence, these energy levels are split in two. (In fact, these two levels are again split by the tunnelling through the higher barrier, but since this is so high the splitting is very small). Mathematically, the Schroedinger equation for this periodic potential is equivalent to the Mathieu equation (or more general Hill's equation).
In the case of H$_2$O$_2$ the tunnelling is so fast, that the molecule vibrates around the lower barrier with a period of ~100 fs. As a consequence, to determine the polarity, you have to average over this motion, resulting in a net polarity.
Note that, if the barrier would be so high that tunnelling would be sufficiently slow, H$_2$O$_2$ would be a chiral molecule!