How do mortgages work?

I am confused on what a mortgage is and how they work. Also, I heard when applying for a mortgage, you need an appraisal ? How does the appraisal process work as well?

Mortgage is a legal agreement by which a bank or other creditor lends money at interest in exchange for taking title of the debtor’s property, and is used to finance (or refinance) your dream homes. Appraisal is part of due-diligence used to assesses the value of the house from an independent, unbiased appraiser and is involved in deciding the riskiness and the value of mortgage that will be offered to you. They send in an agent to check for location, house conditions, neighborhoods, research the housing market and so on before making valuations.