If one wants to refinance a mortgage, does one usually cash out the the equity or can all of it be applied to the new mortgage?
"Usually" is a broad term and I don't know actual statistics, but it's not uncommon to "cash out" equity for various reasons.
I would say that it's sometimes considered a red flag for lenders (meaning that it's assumed that you have to borrow the money for some reason, which is a sign of financial distress). You might end up with higher fees or a higher rate for cashing out. You also have to be careful not to cash out so much equity that you get above the 80% loan-to-value ration and have to pay PMI.
What's more common is to roll closing costs into the loan, meaning you "cash out" just enough equity so that you don't have to pay closing costs when you originate the loan.
There seems to be a misconception in your question that I will try to address through explanation:
What is Equity?
'Equity' in general refers basically to the value of something you own, where you bear the risks and rewards of that asset. This means for example that the bank which holds your mortgage, does not have 'equity' in your house: If your house rises in value, your bank gets no extra profit, and if your house shrinks in value, your bank loses nothing.
In specific, when people refer to their 'equity' in their house, they mean basically the value of the house, above the mortgage value. So if you bought a house for $400k, and you paid $100k as a down payment and then borrowed a $300k mortgage, you would start with $100k in 'equity'. If over the next few years, your house rises in value to $450k, and you pay off $30k of mortgage principal, you would have (450-270 = ) 180k in equity (50k higher because the house rose in value, and 30k higher because you reduced your debt.
How does current 'equity' impact a mortgage refinancing?
(1) Banks want you to have a personal investment in your house - they don't want to loan you the full home value. The reason is if the housing market crashes, and you lose your job and become unable to pay, the bank doesn't want to have to foreclose on your house if it won't pay off their mortgage. So if you have $180k in equity like in the above example, and you fail to pay your mortgage, when the bank pays movers, valuators, realtors, etc. to get the house foreclosed and sold, even if it costs them $140k to do so, then they will sell the house for its $450k value, pay $140k in their own internal costs, pay off their mortgage of $270k, and still have $40k left over [this $40k would go to you, as the owner, because the bank can only keep money to pay off their mortgage].
Imagine if you borrowed $400k for a $400k house, and then the next year couldn't pay your mortgage - the bank would lose money because the market price of the house wouldn't pay off their expenses + the original mortgage amount. Many jurisdictions also require you to have equity in your house, through a down payment, to prevent this type of thing.
So, refinancing your house when it has positive equity [meaning the value of the house is larger than the value of your mortgage] means you don't need to pay any additional down payment to keep the bank happy to loan to you.
(2) Equity can be 'borrowed against' using the same principals as above. Imagine you completely paid off your mortgage, and own a house worth $300k. A bank will be happy to loan you $200k in a mortgage, using your house as collateral. More commonly, if we take the example above and you have $180k in equity, the bank might be willing to loan you additional funds, because your house is worth more than you have currently borrowed, so you could increase your borrowings.
So to get to your original question: can equity be applied against the next mortgage?
Not in the way you seem to be indicating. The equity you have is not a 'prize' that a 3rd party owes you. It is just the difference between your home's value and your current mortgage. You can 'borrow against your equity' and basically take out a new loan, which the bank would be happy to do because they have good security in a high value home. You can also just 'leave the equity there', meaning you will renew your mortgage for the same balance [maybe you just wanted to reduce the interest rate in a good market]. But you can't use equity to 'reduce your mortgage', unless you sell your home now worth $450k, and then buy a smaller house worth $200k [in which case, you could take your $180k in 'equity', and just need an extra $20k in a mortgage to pay it off].