In this article we will dicuss - what I believe - is a quite exhaustive discussion on subordination. The only thing that might complete this discussion, and which is not much discussed, would be actually reviewing clauses in different agreements to underline the usual languae that an instrument might have when it is subordinated. However, besides that, anyone reading this completely should have a 90% proper understanding on how subordination works and why it's of paramount importance for matters involving creditors.
The structure of the article is quite straightforward. The chapter is arranged in the 5 main types of subordination and we discuss everything that might be incident in every type of subordination. In practice, lots of those subordinations are intertwined, as such, at the end, we might show how a company with various debt instruments and different types of subordination could be arranged.
PRELIMINARY
Subordination derives from the idea that every company has a capital structure. The capital structure of the company, as we discussed in previous articles, comes from teh fact taht we have different type of claims arranged in said capital structure, starting from the most basic type of claims: debt and equity. Equity is quite straightforward, however, in the debt side, we can have multiple types of creditors with different types of debt instruments arranged based on risk. Below it is shown the capital structure of a company starting from the most safe (and hence cheapest instruments. Now, lots of diffferent sources might show different variants on what actually is the capital structure of the company. Every one will attempt to establish the capital structure based in terms of priority, those at the top need to recover their debt before anything else can flow to the next creditors in teh list (which resembles a waterfall, and hence, in restructuring practice, the modeling of such distribution is performed through a "Waterfall Model"). Below, I do show from lowest to highest accuracy how a capital structure might be presented and tried - albeit it's not perfect - to categorize based on colors the category of the instrument. Also, soem capital structures might mix the name of the instrument with their positioning in the capital structure. For instance, "mezzanine finance" is as if one might say "bonds", however, in some presentations it is mixed with actual terms for a debt instrument positioning in the capital structure (e.g., senior or subordinated). Other times, there are also mixes between secured and unsecured and other instruments. This, however, just tells you that an instrument has a collateral and just sets a priority of payments on that collateral, as such, it's a mixture. We'll get into more details below. Throughout the discussion, referring back to this table will be extremely helpful.

Spectrum of subordination accuracy, from lowest, to highest.
SOME BASIC TERMINOLOGY
Now, let's set some basic terminology that we'll use along the discussion, including the different types of subordination. First and foremost many sources also use priority, ranking, subordination, preference, and other terms interchangeably. So let's see what each one of those temas.
Priority: Refers to the order of payment or entitlement to assets. It determiens who gets paid first when value is distributed (e.g., in bankruptcy waterfalls, as referred above) -- broad and general term.
Seniority: Is the position of a claim within the capital structure or over a specific asset (for instance, priority might put all the creditors together and ask "Who gets paid first? And then?", meanwhile seniority will be the "arrangement" based on priority in the capital structure. Besides, seniority is often limited to a specific entity level, meaning that it discusses just the current capital structure we have in face, meanwhile priority might put all the creditros together across an entire conglomerate and see how the flow of proceeds might go (this then, in juxtaposition, means that a junior is below a senior, hence also the differences in senior vs. junior).
Ranking: Ranking is the relative comparison between obligations against one another. It answers: "Two questions set side by side, which one stands above the other".
Subordination: Is a legal term, and it sets the legal or contractual mechanisms that establishes that one claim will "sit" below another, creating the priority, seniority, or ranking relationships which we see above. Stated differently, is the relative priority among various tranches of debt.
Hierarchy: Hierarchy means putting all the instruments together based on one or more of the criterias above and see where each one stands.
The differences, at the end of the day, are in practical sense trying to accomplish the same: Establishing which one gets paid first and which one isn't. However, it's still relevant to understand those semantics to not get confuse when one is used instead of the other. At the end of the day, all are trying to address the order of payment, so we could state the same idea through all the terms, for instance:
"Instrument A has priority over instrument B"
"Instrument A is senior to instrument B"
"Instrument A ranks higher than instrument B"
"Instrument B is subordinated to instrument A"
"Instrument A (B) stands above (below) instrument B (A) in the hierarchy"
For a finance professional the terminology might not be as important, but I can perfectly believe that for lawyers put under a litigation, especially one that requires digging through doctrines, those sort of terms can be approached from a more "philosophical" and semantic analysis and led to disputes. However, we might use them interchangeably. Let's move to other terms.
Secured vs. Unsecured
The term of secured means that the debt has collateral. A collateral is an asset that the borrower states taht if it can't repay the debt, then the lender can seize the asset (or the borrowe has to sell it and pass the proceeds). Now, from our order of payments, the secured lender is first in line to collect the proceeds of the collateral, regardless of what other claims are against the company (that is, the other creditors who do not have a claim over this asset, are subordinated to this secured lender). Absent a collateral, the creditor would need to share the proceeds of this asset with the other creditors.
The collateral is granted by a security interest (the security interest is referred also as pledge, lien on, or charge on). In large companies, the creditor despite having a secured claim can't simply immediately seize the assets it has a security interest on. The company will file for bankruptcy and everything will be managed under a Judge's supervision. This is where the term of automatic stay comes from, which means that it puts a "stay" "automatically" on the creditor's claim i.e., their claims can't be advanced (I came up with this, but it's a good association to remember the term).
Now, the creditor might state that if he can't seize the asset or those aren't sold now, then the assets might lose value. As such, bankrutpcy law, when the company is under automatic stay, puts the company in the position to prove that the asset will not be impaired (i.e. it is "adequately protected) if the company wants to continue using the asset instead of selling it. If this can't be demosntrated, the company might be forced to sell the asset and distribute the proceeds to the creditor or will require the company to grant additional collateral. If, on the contrary, the secured claim is "oversecured" (i.e., the value of the collateral securing the claim is greater than the claim), the creditor might be even entiteld to accrued interest during bankruptcy instead of just recovering the face value of its debt (as we discussed in the "Discussing Distressed Debt" article), which is more rare for unsecured creditors.
Now, the reason on why a company might grant securities comes up to two reasons: (a) the creditor wouldn't advance financing if it isn't granted a security, and (b) the company is willing to limit its financial flexibility in order to lower the cost of borrowing (the lower the risk for the creditor, the lower its reward, i.e. interest, will be).
Lastly, another importance aspect in understanding in secured claims is that even if a creditor has a $500 claim and at first had $500 worth of a machinery securing this debt, in case the machinery is now worth $350, the secured creditor will get just this amount and its remaining $150 worth of debt will become a "deficient claim", meaning, it will be unsecured and it will rank pari passu (i.e. on equal ground) with other unsecured debt all else equal. For example, this is shown below:

Example of a deficiency claim and the relationship between the 1st and 2nd lien in such case.
What we're seeing in the picture is that, for instance, the creditor recovered the grey part from the asset up to the limit of the value of the secured asset, but it wasn't enough to cover the entire debt claim. As such, the remaining portion of the debt (i.e. the $120 of the 1st lien debt), becomes part of the unsecured pool and the creditor, despite being 1st lien due to the insufficiency of the asset value to cover its claim, will need to share pro-rata the remaining assets of the company up "for the taking" of all creditors (the value of all unsecured creditors, as such, is shown in green).
1st lien and 2nd lien
First lien and second lien basically sets a priority of payments over a specific asset. Both are secured, and the 1st and 2nd lien establish the priority of payments from the proceeds of that asset. For instance, if an asset is wort $500 and the 1st lien debt is worth $300 and the next one is worth $450, then the 1st lien will get paid $300 and the next one will get paid $200 from the asset ($500-$300). The remaining $250 ($450-$200) becomes a deficient claim (as in the picture above).
Now, in case someone wonders what's the use of this if the 2nd lien might still share proceeds with other unsecured creditors, the idea is that if, for instance, the creditor did not have a 2nd lien, he might had shared the proceeds with other creditors. Let's see an example on granting a 2nd lien vs. not below.

Example of a recovery scenario.
In this example, we see that the 1st lien and 2nd lien share the collateral on an asset valued at $500. The company has in total $800 worth of assets (it includes also this $500). Now, the 1st lien gets $300 on its recovery as he is first in line to get the proceeds of this asset. The 2nd lien manages only to cover $200 of its claim from the collateral. As such, he is left with a deficient claim worth $300 which is moved to the unsecured claims pool to be sharedw ith the other unsecured creditors. The percentage share is calculated by dividing the claim by the total size of unsecured claims in the pool to determine how much is allocated from teh remaining value, pro-rata on that share, to each creditor. As such, the 2nd lien manages to get only $138. Summed to his initial $200 recovered, he recovers a total of $338.5 of assets, which is a recovery of 67.7% (338.5 divided by $500) - this in the spectrum of 1st lien who recovered $300 of their claim. The allocation of 1st lien and 2nd liens is established by contract. Broadly speaking, the 1st lien and 2nd lien flow of proceeds can be someone tied to contractual subordination - the reader will for sure see resemblances below.
Now that we have introduced the important aspects, in the next part we discuss the types of subordination.