Dr Behnam Rostami has decades of hiking and camping experience. Starting a fire when it is raining or when you have a dead lighter is more difficult compared to doing so on a sunny day with a working lighter, but it is possible if you are persistent and know what you are doing. If the weather is wet, you first want to find some dry elements that you need to get a fire going.
You can usually find dry tinder, kindling, and fuel in caves, under rocks, under downed trees or in animal burrows. Sometimes you can create kindling by taking slightly wet sticks and whittling away the soaked parts. You may also search your pockets and backpacks for dry tinder. This is where you can find small pieces of paper or lint. Lint ignites very easily and the biggest problem with it is finding enough of it. Creating a lint ball that is big enough to work as kindling may take up to an hour.
In wet weather you want to protect your fire. Try building it on top of a piece of metal or a rock. Almost any solution is better than wet ground. You also want to have some kind of shelter for your fire. Your goal is to protect your fire from rain drops. You may also be better off if you start a fire without tinder. In wet conditions, tinder is harder to ignite than kindling. Create a small teepee of twigs and light them directly. Experienced campers like Dr Behnam Rostami know that such a teepee can ignite faster than tinder.