In many situations, you can decide to renew a lease directly with the landlord after you have subleased for a while—assuming that you like the space, building, and neighborhood. If you're subletting an entire apartment from someone else, you will probably be required to go through the standard application process.
But if the person that you are subletting from plans to return at some point, then you're probably out of luck. They'll want to keep the lease in their name, so you won't be able to renew with your name on the lease.
If you are living with roommates and you're not on the lease—but you want to be—you should discuss the possibility of being added to the lease. You'll also need to bring this up with the landlord. There are pros and cons to being officially added to the lease, so make sure you understand both before bringing it up.
The information provided on this website does not, and is not intended to, constitute legal advice.