Why the shipping cost is only shown when the customer is logged in in the cart view totals section?
The shipping costs are shown not only after a customer has logged in, but more generally when Magento was able to calculate the shipping costs, either because the user has entered his address, logged in, or used the shipping costs calculator on the cart page.
There are ways to circumvent this. In the past this tutorial has helped me.
There's also third way to see shipping cost in totals -- go to checkout and once you've entered shipping address and shipping method you can cancel the process and return to cart. Since now system knows where you want to send your stuff, shipping data will be displayed.