I am traveling to Shanghai and I heard that you can get a good view of the downtown from Ritz Carlton's roof and the source said it is a free alternative to the observatory decks on other buildings. Now I am curious, can you enter any hotel and go to any floor without having to book a room with them or anything? Are you able to just park your car and enjoy their amenities?
Hotels are private property, but typically have areas open to the public, such as lobbies, restaurants, and bars. This depends greatly on the hotel: a 12-room roadside motel or a remote luxury resort is going to notice you sitting in the lobby fairly quickly and may not have any amenities open to non-guests, while a large urban hotel will have many people passing through and more public areas.
In the specific case of the Ritz Carlton Shanghai, there's the Flair Rooftop Lounge and Restaurant, described by its operators as "China’s highest rooftop bar." It looks like a nice view. There are a number of other rooftop bars in Shanghai as well. Such facilities are for customers, and you'd generally be expected to purchase food or drink (at rooftop bar prices; you're paying for that view) to hang out there.