If Spotify bills you directly, cancel from your account page by opening Your plan or Manage your plan and selecting Cancel plan, then continuing until Spotify shows a confirmation message. That is the standard route for Premium Individual and for Family or Duo if you are the plan manager.
Cancellation usually stops the next renewal rather than ending Premium immediately. Spotify says Premium stays active until the next billing date, then the account drops to the free tier. The main exception is a zero-priced trial: if you cancel during that period, Spotify says the account switches to free straight away.
Canceling Premium does not wipe your library. Spotify says you keep your playlists and saved music after the account returns to free, but paid benefits such as ad-free listening and offline music downloads end with the paid period.