According to Faraday's Law of magnetic induction, a changing magnetic flux $\phi_B$ will produce an electromotive force (emf $\epsilon$) in an adjacent coil loop.
$$\epsilon =-\frac{d \phi_B}{dt}$$
So as the permanent magnets move past the coil, the magnetic flux through the coil changes, resulting in an electromotive force which can be used to power a light source such as an LED.
Its the changing magnetic flux through the coil which induces a voltage. The magnet itself does not need to go through the coil.
As for building one yourself, it looks simple enough. The main thing is to make sure the coil has adequate number of windings to produce the required voltage. More windings will result in higher voltage for a given flux rate.
Also, the wire in the coil must be able to carry the load current. LED lights are usually quite low current so this is unlikely to be an issue.
The two magnets will cause a voltage in the coil to pulse as the wheel goes around. If you add a capacitor in the circuit, you may be able to make the circuit sustain a light rather than flashing, but a flashing LED is more likely to draw attention and is therefore usually preferred.