Royalties are normally paid to a landowner by a company extracting oil or gas from the landowner's property. In the United States the landowner is the owner of the surface and everything built there, as well as of the mineral rights. He owns a cone down to the center of the earth. He does not own the exension of this cone into the universe. However, legally, such a cone of air and void beyond the atmosphere can paly a role: I remember that flying over Texas, I could not get a drink at a certain moment, the stewardess explaining that we happened to fly over a "dry"county!.
In probably most other countries, the landowner has only rights to the surface and possibly a sand or gravel pit. The oil and gas riches belong to the state. Companies may have to buy or lease some terrain for their extraction facilities, but do not have to buy all the surface above the deposit.

Royalties are a conveniet instrument for the landowner (or government) to obtain a cashflow from oil and gas production, even before a company makes a profit. The profit, when made, is taxed in other ways. because of the present value effect, a new venture may suffer in profitability if high royalties have to be paid.

Royalties come in several flavors: In cash or in kind. The latter means that a government obtains the actual oil to send it to a refinery. Royalties may be deductable for tax purposes in some contracts. Usually there are different percentages royalty for oil and for gas, which can vary from a few percent up to 50%. Also, different percentage often apply to different technical environments, say between water shallower than 400 m waterdepth versus beyond 400 m. In 2010 the state of Alberta (Canada) lowered the royalties for gas from 40 to 36% and for oil from 50 to 40%.
In some contracts the royalties follow a sliding scale, increasing with increasing production.