One of the advantages of leasing is the opportunity to drive more car than you afford to buy. You can get more car for less money with a lease because you only pay for what you use during the lease term.
Let's say you lease a $50,000 car over a period of three years. The terms of the lease say if the car is driven 36,000 miles or less (the mileage cap) and maintained in a certain condition, the car will be worth $20,000 (the residual value) at the end of the lease. Thus, the total of your payments come to $30,000. You get to drive a $50,000 car for three years, for only $30,000.
And, if you'd like, you can buy the car at the end of the lease term. Which begs the question: Should you buy your leased car when the lease ends? Well, it depends.