The principle is reversing how loudspeakers work: loudspeakers vibrate and produce sound from an electric current. Apply this reversely and you can produce electricity from the passing cars' vibrations. The concept was first implemented at the Goshiki-Zakura-Ohashi-Bridge over the Arakawa River on the Central Circular Route, one of the five famous bridges on the Shuto Expressway. Not that they get a lot of power, but the churned electricity is enough power for some of the lights on the bridge (pictured above).
[Source: Japan for Sustainability]