In Shopify like in many other CMS’s first you install the theme and after you make it live or publish it like in the case of Shopify.
You can add up to 20 themes to your online store, but only one theme can be published (live) at a time.
When you reach the quota of 20 themes you need to remove the ones that you no longer need or use to make room for new ones.
Shopify “Theme Library”
One thing to note is that all themes go to the “Theme library”, no matter from where you install them: “Shopify theme store”, upload them via the uploader or via Github.
No theme will be directly published live upon installation.
The published theme is what your store customers view when they visit your Shopify store.
If you change your theme with a new one, your previously published theme moves to a section called “Theme library”.
All changes that you made on the previous theme that moved to the “Theme library” section remain intact since in Shopify theme customization made via the “Theme editor” are stored on the theme level in JSON files, not in a database.
If you know how to code you can edit the JSON files directly and it will reflect in your theme editor and in the store front.
All themes that are located in the “Theme library” can be previewed, customized or you can perform tests on them.
The “Theme library” is also the backup area for your theme and the playground to try new things with your themes without affecting the storefront.
Every time you make changes it is better that you duplicate your live theme in the “Theme library” and make all the changes needed including code, theme customization via code editor and so on.
Once you complete all changes you can “Preview” the theme in the storefront exactly like you see the live theme.
After you decide that all is good you can publish the duplicate theme live.
First make sure you are logged inside your Shopify store. If you do not know how to login follow this tutorial: How to login into your shopify store?
Install themes directly from Shopify admin
Go to the “Online Store” channel and click on the “Themes” menu item (marked with 1 in the image below).
As you see the “Current theme” (marked with 2 in the image below) is marked as being current and that means that it is live on the storefront and your customers will see it and interact with it.
All new themes that you add to your Shopify store will go into this section called “Theme library” (marked with 3 in the image below).
In order to add a new theme click on the “Add theme” button (marked with 4 in the image below).

For this first step I’ll install themes locally directly from the “Popular free themes” section (marked with 1 in the image below) that allows me to install a listed theme in this section without visiting the “Theme store”.
I’ll choose the “Craft” theme and click the “Add” button (marked with 2 in the image below):

Shopify is starting to install my theme by copying the files from Shopify theme store servers and it lists a message (marked with 1 in the image below) to notify me about the operation being done.
In the “Theme library” you can see the selected theme and a message that says “Installing theme” (marked with 2 in the image below). As long as this message is displayed the theme is installing.
Usually it takes a couple of seconds for themes added from the theme store to install since they are light, for bigger themes, not listed in the theme store, that come from third-party developers this process could take more depending how big the theme is.

If the theme is installed successfully you’ll see a success message (marked with 1 in the image below) and inside the “Theme library” you’ll see a small badge that says “Just added” (marked with 2 in the image below).
As it is now inside the “Theme library” the theme will not be visible to your store customers in storefront but it will be visible to you and to all your staff that is logged inside Shopify and you can “Customize” the theme before publishing it live.
For customization click the “Customize theme” button (marked with 3 in the image below) or the one (marked with 4 in the image below).
After all your customizations are completed and you want to publish the theme to be visible in the storefront click the “Publish” button (marked with 5 in the image below).

A pop-up that asks for a confirmation will display. This is for your own safety. If you made a mistake or changed your mind this is your last call, once you click the “Publish” button the theme will go live.
If all is good and you are sure you want to publish the theme live click on the “Publish” button as listed in the image below.

Now the “Craft” theme moves from the “Theme library” to the live theme section and is highlighted with a “current theme” badge (marked with 1 in the image below) as being live.
At this point all your store visitors will see your new theme in the storefront.

Install themes from Shopify theme store
If you do not want to install a theme from the “Popular free themes” section you need to go to the Shopify theme store.
To navigate to the theme store click the “Visit Theme Store” link like in the image below.
Use this link and do not go directly to the theme store since you need to be logged inside your Shopify account to install themes from the shopify theme store.

Using this link will keep your session and you’ll see on the page top right the “Log out” button like in the image below.
This means that you are currently logged into your Shopify account and you can install any theme from the theme store into your “Theme library”.

Again as you browse the themes on the Shopify theme store you can see your authentication session open (marked with 1 in the image below).
Use the filters to find the theme you want. I’ll check “Free” (marked with 2 in the image below) since I want to use a free theme.
Actually the “Free” themes are not free since they are included in your Shopify subscription and in fact you pay for them. Without an active Shopify subscription you can’t use any of the “Free” themes.
Don’t think that because they are free the themes are poor quality. They are not. They are high quality and many of them are better than many premium themes.
I use many of the “Free” themes for my clients and with some code tweeks they perform super well.
I’ll select the “Spotlight” theme. Click on the theme (marked with 3 in the image below).

Install it by clicking the “Try theme” button like in the image below:

Once you do that the theme will start installing into your store and more exactly will be added to the “Theme library”. See below image:

If the installation was successful you’ll see a success message (marked with 1 in the image below) and you’ll see the theme added to the “Theme library” (marked with 2 in the image below).
Customize the theme if you want and when ready publish it to live by clicking the “Publish” icon (marked with 3 in the image below).

Final step is to confirm that you want the theme published to live in the pop-up like in the image below:

The new theme will be moved to live and you’ll see the badge “Current theme” (marked with 1 in the image below) and the previous live theme moved to the “Theme library” (marked with 2 in the image below).

Install a custom theme
In the majority of cases if you opt for a custom theme, the theme is developed in your store, but it depends how you agreed with the developer.
Some developers will develop the theme in their environment for better integration with their tools and give you the zip file for installation on your store.
Another case is when you may buy one from a theme developer that is not listed in the Shopify theme store.
In all these cases you need to manually install the theme to your “Theme library”.
On the Shopify “Themes” page go to “Add theme” and click on the “Upload zip file” like in the image below:

The “Upload theme” pop-up will open. Click on the “Add file” button to upload the theme ZIP file from your local device:

Select the theme ZIP file (marked with 1 in the image below) and click “Open” (marked with 2 in the image below) to open the file in Shopify:

Now you should be back to the “Upload theme” pop-up and you should see in the pop-up your theme file that you selected from the local device (marked with 1 in the image below).
If all is good click the “Upload file” button and this will upload the file to the “Theme library”:

Once the pop-up will close you’ll see the custom theme installing on the “Theme library”:

When the process of installation is complete you will see the “Just added” badge next to the theme name (marked with 1 in the image below).
At this point in time your custom theme is installed on the Shopify “Theme library”.
You can customize it by clicking the “Customize” button (marked with 2 in the image below).
When you are ready to publish the theme to live click on the “Publish” button (marked with 3 in the image below).

The confirmation pop-up will display asking you to confirm that you want to publish this theme to live. If you are sure click on the “Publish” button:

Now your custom theme is live and customers can see it in the storefront. You’ll also see a “Current theme” badge next to it (marked with 1 in the image below) .
The previous theme will be moved to the “Theme library” (marked with 2 in the image below).
At any time you can switch the previous theme back to live and vice versa.

Conclusion
There is another way to install themes on Shopify and that is via Github but these require a separate tutorial and this is targeted more to developers and not to the Shopify everyday user.
Shopify themes page with all the sections is well organized and this is why changing themes on Shopify is an easy task.
Since Shopify is a cloud platform the process is slightly different from open source CMS like WordPress, Joomla and so on but straightforward once you know how to do it.