Assuming you do want to buy it and that you need a loan, you should get loan offers before the lease officially ends. But be careful with timing — don’t apply more than a month ahead of time, because most loan offers are only good for a month. After the loan offers expire, you’ll have to apply all over again. But, also, don’t apply for loans too late — if you keep the car for a few days after lease-end without buying it, you may receive penalties.
Tell the lender you want to do a lease buyout. They may ask if you’d like to apply for a loan with them for the remaining value of the car. And if you’re satisfied with your experience with them as your lease financing company, why not apply with them to buy the car? But don’t apply to just one place — you won’t hurt your credit by applying to multiple places within a two-week period. Apply to several lenders, see what they offer and take the loan that best suits you.