I'm not sure if they would be titled as fakirs, but I know that some Hindus and Buddhists also practice things like walking on hot coals, lying on nails or fasting for many days.
Even regular people do such things sometimes hoping that they will get something in return from God. It's sort of like a pact. For example, if a man's daughter has fallen really sick and the family is unsure what to do because she is not responding to treatment; the man might walk on hot coals or fast until she is better.
I think what lies behind all of these practices is belief. Fasting or burning your feet does not heal someone, the belief that they will heal, does. The practice is kind of a test for that individual and a plea to the Divine for help.