A transit visa is a temporary short period visa during your journey.
Transit travelers are those not staying in the country or even leaving the airport. If there’s a “transit” area, you can head there and won’t have to go through customs. Some countries require visas of even transit travelers, so it’s best to check any visa requirements before visiting a country, even if you’re never leaving the airport.
For most layovers, you can leave the transit area (and airport) in between flights, as long as you have a visa (if necessary) and go through customs and immigration on the way out, and of course you’ll have to pass through security again on your way back into the airport. However, some tickets may not permit you to leave the airport. Always check beforehand with your airline to see if your ticket allows you to leave the transit area.