A campfire is essential to survive when stranded. To increase their hunger reduction properties, you can cook raw meat and fish by standing close enough to the fire and click "use" in your inventory. Furthermore the campfire is needed to craft several other items like torches, iron rods, etc. You can light a torch by hitting the campfire while holding the torch in your hand.
Rain will put out a campfire and you will have to light it again after it stops raining.
Building a campfire is a requirement to unlocking several other buildings.
There are several methods to light a fire. You can combine a branch with a bark, use two flintstones, or hit the campfire with a burning torch. When it's raining it is not possible to light a campfire.
It is recommended to always store a burning torch, because you can use it to light a campfire after rain puts it out.