Depends on the age of the heater. If you light the pilot with a match, you should be able to remove the thermocouple with the burner in place. The end that is in the flame will pull out of the clip that holds it. The control valve end unscrews.
If you have a newer one that lights the pilot with a sparker, you have to remove the burner as a unit. There should be two screws holding the cover plate in place, the gas line to the burner, the thermocouple and the wire for the sparker. Disconnect all of these from the control valve and the unit slides out through the hole. Then change the thermocouple and replace.
There are many pictures of this on Google.
$387.
Right below the thermocouple if applicable
$6 to $10 depending on where you are and where you get it from.
Most likely the thermocouple is bad. The thermocouple is the little tube that sits in the flame of the pilot light. Runs from the pilot light to the control valve. Very simple to replace. Costs about $6.
Usually less than 1 hour work, ( but nobody will bill one hour) Part costs less than $10 and any competent handyman can do it.
THERMOCOUPLE or defective gas valve
You do NOT clean a thermocouple. They are really inexpensive and when they are giving problems have a LMP / or Gas fitter replace it
Electronic ignition refering to it having a sparker to light the pilot light? That just lights the pilot, there is still a thermocouple that controls the gas valve. The thermocouple is the small tube that sits in the pilot flame and runs to the control valve. To replace, you will need to remove the cover plate, gas line, thermocouple, and sparker wire as a unit and replace the thermocouple once you have it out and them re-install the unit.
low back, spillage, or a bad thermocouple.
Sounds like you need a thermocouple.
Older ones where you light the pilot through the access panel, the thermocouple pulls out of a clip at the pilot light and unscrews from the bottom of the control valve. Pull and twist it at the pilot to get it out of the clip. Newer ones with a spark igniter and sealed at the bottom, you are going to have to take the panel and the burner assembly out as a unit so that you can replace the thermocouple. Unscrew the pilot light gas supply tube and the thermocouple from the control valve, remove the screws holding the view plate on and the whole thing slides straight out the hole. Replace the thermocouple and re-assemble.