It’s really simple actually, and very cheap to produce...which is why there was so much excitement when LED lights were first invented!
The Technical Details: LED lights are composed of two types of semiconducting material (a p-type and an n-type). Both the p-type and n-type materials, also called stringent materials, have been doped (dipped into a substance called a “doping agent”) so as to slightly alter their electrical properties from their pure, unaltered, or “intrinsic” form (i-type).
The p-type and n-type materials are created by introducing the original material to atoms of another element. These new atoms replace some of the previously existing atoms and in so doing, alter the physical and chemical structure. The p-type materials are created using elements (such as boron) that have fewer valence electrons than the intrinsic material (oftentimes silicon). The n-type materials are created using elements (such as phosphorus) that have more valence electrons that the intrinsic material (oftentimes silicon). The net effect is the creation of a p-n junction with interesting and useful properties for electronic applications. What those properties exactly depend mostly on the external voltage applied to the circuit (if any) and the direction of current (i.e. which side, the p-type or the n-type, is connected to the positive terminal and which is connected to the negative terminal).
Application of the Technical Details to LED Lighting:
When a light-emitting diode (LED) has a voltage source connected with the positive side on the anode and the negative side on the cathode, the current will flow (and light will be emitted, a condition is known as forwarding bias). If the positive and negative ends of the voltage source were inversely connected (positive to the cathode and negative to the anode), the current would not flow (a condition known as reverse bias). Forward bias allows current to flow through the LED and in so doing, emits light. Reverse bias prevents current from flowing through the LED (at least up until a certain point where it is unable to keep the current at bay - known as the peak inverse voltage - a point that if reached, will irreversibly damage the device).