To answer the OP, there is an international governing body called the International Civil Aviation Organization, which is attached to the UN, and serves as an international forum for the arrangements necessary between countries.
By and large, nations realize that commercial aviation brings commerce, and commerce brings money (either in the form of taxes or an infusion of capital). Thus (and in theory), nations are generally accepted as wanting commercial aviation services, so they’ll negotiate to get it. For this, they’ll draft up national codes and regulations to promote it, including certification of airlines, pilots, and airframes [sub]and the business practices of all those too[/sub]. It’s that regulatory stuff that the airlines then have to flesh out if they want to fly into or out of a country. Sure, Tooniverse Airlines can fly your cargo and people within the United States all it wants, but if it wants to fly that stuff to France and pick up a shipment of escargo [sub]for cargo, get it![/sub], it then has to meet all ‘o’ France’s rules of the skies.
So, to answer your question(s), national governments meet to agree to standards of international commercial aviation (a lot of it is based on the available technology of the time). These agreements are enforced by the national agencies who have the teeth to enforce such agreements. The airlines then have to meet the regulations of the national agencies. As far as the actual flight itself? That’s handled by each nations air traffic control systems. . .
Interests in commerce dicate that flights will happen, but individual nations’ specifics on what happens during those flights are subtle–the methods all have to be within the guidelines or commercial air navigation laid out by the ICAO. It is possible that nations will not allow flights into other/their countries for political reasons (i.e. the US and Cuba). That’s more political in nature, but is again enforced by the national agencies, and if necessary, but the nations’ Air Forces as well.
Military flights are a whole other thread, but I do have friends that worked in CAOCs and handled the various international clearances for flights. Things for them got hectic at times, especially if there were weapons involved, or if there was hazardous cargo onboard.
Tripler
Have I confused you yet?