You are obliged to provide a notice within the terms of the tenancy agreement, it usually depends in what type of tenancy agreement is approved by both parties.
An Assured Shorthold Tenancy Agreement is a type of agreement wherein the timeframe of your tenancy will have an end date which will allow you to leave when the term is finished. Within the contract of tenancy is also a break clause, this agreement can permit you to end the tenancy earlier however, upon using this term you need to provide specific terms within the clause that says you are planning to leave on an earlier time instead of leaving within the agreed timeframe.
You can also be in a “rolling contract” this is a common case between you (the tenant) and the landlord approving you to stay within the property without renewing the contract and upon doing this you can also add additional fixed terms within the agreement, this term will then be called a “statutory periodic”. Within the agreed terms there is no end date of tenancy, so you will serve a notice 1 month ahead when you will be planning to leave the property.