Helen here from Shopify Support. Thank you for your question.
One way to arrange the products in your collections to have the out of stock items displaying last, is to manually arrange the products in the collection. This will require you to adjust the order of your products within a collection as they run out of stock, and then again as they come back in stock.
To automate this process, I suggest using an app. Custom Collections Builder has the ability to create collections with specific product arrangement options, such as by stock quantity. As the inventory of an item increases or decreases, the app will detect the changes and adjust the order of the products in the collection as necessary.
Custom Collections Builder has a 15-day free trial, so I recommend adding it to your store, and spending that time to determine if it works to your preference. If it does not, simply uninstall it before the trial expires and you will not be charged for it.
Are you interested in letting your customers know when out of stock items are back in stock? If so, the App Store has options for this as well. For example, Back In Stock: Customer Alerts enables your customers to receive an email or SMS text message when the item they are wanting is available to purchase again. This is a great way to encourage recurring traffic to your store.
The Custom Collections Builder and Back In Stock: Customer Alerts apps are created by third party developers, so if you have questions about the set up, or functionality of either of them, please reach out to the developer directly. We have instructions on how to contact third party developers for assistance here.
Please let me know if you have any more questions.
If you're still looking for a solution, our app, Push Down & Hide Out of Stock, does exactly what you want!
You can move out of stock products to the bottom of the collection with our app. Also, if you don't re-stock a product, you can hide it automatically.
You can find more details on our app page.
We have a free plan, and if it is suitable for you, you can use it for free!
If you have any questions, please don't hesitate to reach out to us at firstname.lastname@example.org