Before lenders make the decision to give you a loan, they must know if you're willing and able to repay that mortgage. To understand your ability to repay, they look at your income and debt ratio. To assess how willing you are to repay, they use your credit score.
Fair Isaac and Company calculated the first FICO score to assess creditworthines. You can find out more on FICO here.
Your credit score comes from your repayment history. They don't consider income or personal characteristics. These scores were invented specifically for this reason. Credit scoring was envisioned as a way to assess willingness to repay the loan while specifically excluding any other irrelevant factors.
Your current debt load, past late payments, length of your credit history, and other factors are considered. Your score is calculated from both the good and the bad of your credit report. Late payments count against your score, but a record of paying on time will raise it.
To get a credit score, you must have an active credit account with six months of payment history. This history ensures that there is sufficient information in your credit to calculate an accurate score. Some people don't have a long enough credit history to get a credit score. They may need to build up credit history before they apply.