If you own shares in a company, there is no general reason why you cannot continue to own the shares after you retire. However, private companies sometimes have provisions within their articles of association, or a shareholders' agreement, which require you to sell your shares when you stop being an employee or a director of the company. Those provisions may also require you to offer your shares to your fellow shareholders at a prescribed price before offering them to a third party purchaser.
If you are a sole trader and have employees in the business, you can retire from working in the business and still continue to receive the profits. You may consider this a suitable time to form a company (in which you own shares), transfer the business to the company, and remain a shareholder in that business.
If you are a partner, it may be possible to agree with the other partners that you will become a sleeping partner - in other words, that you will retain some rights to the profits of the partnership, but cease to take an active role in it. However, you will then remain liable for the debts of the partnership. You may want to seek an indemnity from your 'trading' partners.
Whatever form your business takes, you may in any case prefer not to retain ownership once you have retired. Many retired owners find it difficult not to interfere in the business going forward and to watch the new management take the business in a new direction which they may not agree with. There is also the reluctance and potential danger in being financially exposed in a business which they no longer control.