How do banks determine this?

I am interested in finding out more about home loan eligibility. How do banks determine whether you are eligible for a home loan, and if so, how large a loan you are eligible for? Is there somewhere that I can go to find a detailed explanation for this process? That way I can maximise my chances of getting a home loan when I need one. I can make some changes like paying down my debt a little more before applying for the loan if I know that they will help me in the process of getting a home loan and purchasing a house.