I am not sure how well they work compared to a mechanical one, but you have 4 poles, 2 X and 2 Y. They send signals to their sister poles and measure the time it takes to receive the pulse. Wind interferes with that, so the longer it takes between sending and receiving a pulse, they stronger is the wind.
And by measuring both axes, they can also determine the wind direction.