We've shared heaps of ways to stay safe and seen while riding your bike, but if you're looking for something automatic that you build once and works forever, this DIY safety light is induction-powered, mounts on your back wheel, and stays lit as long as you keep pedalling. Plus, it's easy to build.
You'll need the right components, of course, including some magnets, spoke mounts for the light itself, an LED, and some electrical components (diodes, resistors, etc) that you can get at an electronics or hobby store (or just buy online.) Instructables user tom4zs had the spoke mounts 3D printed online, and even includes the schematics to get them printed yourself, but you could rig your own attachment if you prefer. The whole parts list is at the link below too.
Ultimately, when you assemble the whole thing, you'll notice there are no batteries and no on/off switches. The whole rig is smart enough to know that you're pedalling and uses the energy of you pumping the pedals to power the LED. Plus, once you have all the components, putting everything together is really as easy as soldering a few wires and then screwing the thing onto your bike. Check out the full tutorial below -- it's seriously only a few steps.
Bike Wheel Induction Safety Light [Instructables]