Before deciding on what terms they will offer you a loan (which they base on their risk), lenders want to discover two things about you: your ability to pay back the loan, and if you are willing to pay it back. To assess your ability to repay, they assess your debt-to-income ratio. To assess how willing you are to repay, they use your credit score.
The most widely used credit scores are called FICO scores, which were developed by Fair Isaac & Company, Inc. Your FICO score ranges from 350 (very high risk) to 850 (low risk). For details on FICO, read more here.
Credit scores only assess the info in your credit reports. They don't consider income or personal characteristics. Fair Isaac invented FICO specifically to exclude demographic factors like these. Credit scoring was invented as a way to consider only that which was relevant to a borrower's willingness to pay back a loan.
Deliquencies, payment behavior, current debt level, length of credit history, types of credit and the number of inquiries are all considered in credit scoring. Your score reflects the good and the bad in your credit history. Late payments will lower your credit score, but consistently making future payments on time will improve your score.
Your report should have at least one account which has been open for six months or more, and at least one account that has been updated in the past six months for you to get a credit score. This payment history ensures that there is enough information in your report to calculate an accurate score. Should you not meet the criteria for getting a score, you may need to establish a credit history before you apply for a mortgage loan.