Before deciding on what terms lenders will offer you on a loan (which they base on the "risk" to them), they want to know two things about you: your ability to pay back the loan, and your willingness to pay back the loan. For the first, they look at your income-to-debt obligation ratio. For your willingness to pay back the loan, they consult your credit score.
The most widely used credit scores are FICO scores, which were developed by Fair Isaac & Company, Inc. (and they're named after their inventor!). Your FICO score is between 350 (high risk) and 850 (low risk).
Credit scores only consider the information contained in your credit profile. They do not consider your income, savings, down payment amount, or demographic factors like gender, race, nationality or marital status. In fact, the fact they don't consider demographic factors is why they were invented in the first place. "Profiling" was as dirty a word when FICO scores were invented as it is now. Credit scoring was developed as a way to consider only what was relevant to somebody's willingness to repay a loan.
Past delinquencies, derogatory payment behavior, current debt level, length of credit history, types of credit and number of inquiries are all considered in credit scores. Your score considers both positive and negative information in your credit report. Late payments will lower your score, but establishing or reestablishing a good track record of making payments on time will raise your score.
Different portions of your credit history are given different weights. Thirty-five percent of your FICO score is based on your specific payment history. Thirty percent is your current level of indebtedness. Fifteen percent each is the time your open credit has been in use (ten year old accounts are good, six month old ones aren't as good) and types of credit available to you (installment loans such as student loans, car loans, etc. versus revolving and debit accounts like credit cards). Finally, five percent is pursuit of new credit -- credit scores requested.
Your credit report must contain 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 ensures that there is enough information in your report to generate an accurate score. If you do not meet the minimum criteria for getting a score, you may need to establish a credit history prior to applying for a mortgage.