It's all negotiation-based between borrower and lender. Not much of a secret. Capital is generally a commodity so the economic environment, lender appetite, and competition dictate what goes and whatnot in those agreements.
Hypothetical discussion:
L: Here is your 1L debt @ 5% quarterly payments.
B: But you're competition is offering it @ 4.5%.
L: Then we can offer less restrictive covenants.
B: That's sweet. Can we remove X line in A covenant?
L: Fine, you're in a non-cyclical business, so the collateral will not fluctuate in value. We can do it.
If you are curious about the finance side of the business, lenders will analyze the business model of the company and its financial statements with the main intent to understand if the borrower can repay in full at the pre-specified dates the interest and principal. Everything else: Collateral, covenants, monitoring, etc. are there as additional protection so the lender is protected on the downside (acceleration, having a say on transactions that may impact revenue, etc.).
This one is a recommended read on this topic from the business side (less than 200 pages, and very clear):
https://www.amazon.com/Pragmatists-Guid ... 0132855232