A domain name is just an address to a website and independent of the web hosting account and its content - collectively referred to as a website.
When you sell a domain, you grant permission to the purchaser to transfer it to either a new domain registrar or different account at the same registrar. Steps include unlocking the domain if it's locked (to prevent transfers), obtaining the "authorization code" which will need to be supplied during the transfer for confirmation, and any additional steps required by your domain registrar (typically none). There should be information in their FAQ's or knowledge-base detailing the steps to transfer a domain.
Unless you make an agreement with the purchaser of your domain name to also purchase your website's content, then when the domain is transferred none of your website's contents will be displayed. The new domain owner will have to upload content to his/her web hosting account.
So in short, selling a domain name does not mean that you're selling the website and its contents too (unless you offer it as a package deal through a site like Flippa).
Lastly, not described in your question but referred to in its title: Once your domain name expires and you can't renew it (in the case where it's been sold already), then obviously you can no longer sell it, so don't let it expire if you think it has enough value to sell and warrants the steps to do so. Again, content is independent of the domain name, so could be sold regardless, though not commonly done unless it has significant value.