On Jewish holidays, within each 24-hour (night-day) holiday unit, we are permitted to make preparations for all of that unit, but we are forbidden to make any preparations for the following unit, which begins after nightfall. (For example, on a Wednesday night holiday, one may cook for Wednesday night and Thursday. But anything to be used on Thursday night or Friday may be done only beginning Thursday night after nightfall.)
The one exception is when a Friday holiday is followed seamlessly by Shabbat, in which case, cooking is permissible on Friday through a mechanism known as an eruv tavshilin, whereby the cooking process is begun prior to the holiday.
If a holiday day — whether the first or second day of a holiday — falls on a Friday, an eruv tavshilin is set aside on the day preceding the holiday (Wednesday or Thursday afternoon), so that we will be permitted to prepare for Shabbat (cooking as well as any other necessary preparations) on the holiday. Only one eruv is required per household.
This eruv consists of a challah or two matzahs, and a cooked food, such as meat, fish, or an unpeeled hard-boiled egg.
Take the food items (it is a good idea to wrap them in aluminum foil, or another distinctive packaging, to easily keep them apart from the rest of the foods in your home), and give them to another person (if possible an individual who is a non-dependant), and say:
I hereby grant a share in this eruv to anyone who wishes to participate in it and to depend on it.
The one holding the food raises it a handbreadth, and then returns it to the person making the eruv, who then recites the following:
Blessed are you, L-rd our G‑d, king of the universe, who has sanctified us with his commandments, and commanded us concerning the mitzvah of eruv.
Through this [eruv] it shall be permissible for us to bake, cook, put away a dish [to preserve its heat], kindle a light, prepare, and do on the holiday all that is necessary for Shabbat — for us and for all the Israelites who dwell in this city.
The eruv is put away until Shabbat, when it is eaten. In many communities, it is customary to use the challah or matzah as one of the two loaves of bread used at the Shabbat meal.1
The eruv tavshilin only allows food preparations if the food will be ready with ample time remaining before Shabbat; enough time to theoretically allow the food to be consumed before sunset (if a troop of guests happens to trudge in to your home). This is an importnat detail to bear in mind when preparing the cholent, which cooks on the stove until the following day.
The eruv tavshilin only allows one to cook on Friday for Shabbat, it does not permit cooking from one day of the holiday to the next (i.e. Thursday for Friday).
On holidays it is only permissible to cook from a pre-existent flame, one that is burning since the onset of the holiday.