The birth of the little, yellow-skinned lads and lasses that will eventually become the Lego Minifgure begins as small, clear ABS plastic pellets. These are delivered straight to the molding factory via truck. They begin coloring it by adding dyes and colors to the plastic. Soon, the pellets are heated into another shape of plastic that almost looks similar to toothpaste at 230° celsius.
Next, the plastic is inserted through a tube into a molding machine. Each and every single Lego element has a mold. These molds shape the plastic into the Lego piece it was created to make.
Then the hot and nearly ready Lego parts are released from the mold, into a sorting machine. These machines are rather self explanatory; they sort the elements into groups.
Where they go from there depends. If they need printed decals, like the ever-popular minifigure face, machines will print them on the Lego piece itself, much like how you print documents onto paper. If the element does not require the printing treatment, it will simply avoid this step entirely.
Finally, the Legos are bagged for a Lego kit, and any big or important parts are inserted in with the bags. Instructions are boxed, and the boxes are inserted into bigger boxes for store shelves.