Foiling is produced by a 'hot foil' machine that heats a plate. This machine foils when a negative plate is positioned, and heated to the required temperature and then pressure is applied in order to 'release' the foil. Most hot foiling is done around the 100 degree mark, but printing on paper, card, leather and plastics the temperature can vary enormously.
As pressure is applied this also means you can emboss (push the design out of the card or paper). The plates are usually made of magnesium or copper and are etched to form a negative of the required artwork. They are bolted or glued to the hot plate of the hot foiler and then the item to be foiled is aligned to match.
The foil in hot foiling comes on a roll which when sandwiched between the item being printed and the plate, releases the foil from the roll onto the item being printed on all areas that the design on the plate touches.