There are 3 cellphone service providers in China - China Mobile, China Unicom, and China Telecom. Of these, the best option for foreign travelers is Unicom because they're cheaper and their network supports almost all international phones whereas some many non-Chinese devices may not work on China Mobile's 4G network
The most convenient place to get a Unicom SIM card in Shanghai is inside the baggage claim area at the Pudong International Airport. However, the price at the airport is 2-3X the price of a similar card in the city. So I recommend getting the SIM card in the city and not at the airport.
You can buy a SIM card at any Unicom branches in the city, and there are over 300 of them in Shanghai so you should be able to find one quite easily anywhere
Google Maps shows a small number of major Unicom branches listed if you search "China Unicom" while zoomed into Shanghai
Baidu Maps has the most comprehensive list of Unicom locations listed on a map, though all labels are in Chinese. To use it you go to maps.baidu.com, then zoom into Shanghai (type "shanghai" into the search bar, then zoom into area you're at), then copy and paste "联通营业厅" into the search bar and press enter for a list of Unicom branch locations on the map
When looking for the branch in person, look for this logo:
There are different packages, but the most popular one with travelers costs 99RMB for 20GB of data and 200 minutes of domestic voice, as of 2018. You will get SMS with this package too.
To get the SIM, walk into any Unicom branch with:
Your smartphone that's unlocked (you need to check with your own carrier to see if it's unlocked)
Cash (international credit cards are not usually accepted)
At the branch tell them you want to buy the99-yuan SIM card ("99元SIM卡"), or ask them for the current price list and give them your passport. That's all it takes. If you don't know how to change your own SIM card (it's super easy), they can help you with that too
Note that in China our internet is censored even on mobile, so be sure to have a VPN app on your phone before you visit to be able to continue to access Facebook, Google, and other web services