The purpose of requiring airport transit visas of certain nationalities is to prevent asylum seekers from traveling to the host country under the guise of transiting towards somewhere else. Once someone is physically present on the host country's sovereign soil (which includes an airport's international transit area) and lodges an application for asylum, the host country is obliged to house and feed the applicant while they process the application. Governments tend to find that distasteful, especially when in their experience many frivolous asylum applications are made by citizens of particular countries.
Thus, the enforcement: If someone without the required airport transit visa shows up and petitions for asylum instead of traveling onward, then the authorities will know that whatever airline he arrived on has been too lax in checking his visa before he boarded. The airline will then be fined.
This motivates airlines to check transit visa for everyone of the relevant nationalities.
It is true that if someone without a visa is let through by the airline and turns out to be honest and proceed to his final destination, the government will never know about that. But since the airline can't distinguish honest passengers from dishonest ones, they need to check everybody.