The pilot light stays lit because of a small amount of gas that is released into a small valve keeping the flame burning. Inside of the pilot light there is a small device called a thermocouple which monitors the light to make sure it doesn’t go out. If the pilot light goes out without you knowing it can leak gas into your home which can cause an explosion. THANKFULLY, the thermocouple uses the heat to keep the valve open. If the light goes out, the valve cools down causing it to close and cut the gas off. (how cool!) If you need to relight the pilot, all you need to do is reopen the valve (typically done by a push of a button) and use a lighter to start the light again!