1) To renew your resident permit for work in Shanghai, you need to first collect the needed documents. These documents include:
Renewed foreign expert permit -- ideally your work place will do this for you.
Passport
Registration of residence + photocopy -- the officier will look at the original and keep the copy. This is the paper you get from the local policy station when you register yourself within 24 hours after entry into the country.
Official letter from your workplace
A photo (that you affix to the resident permit application that you will fill out at the Exit-Entry Admin Bureau)
If you are applying for the resident permit for the first time, you will also need:
Health exam report
Employer license
Note that I am making this list from memory. So I might have left something out.
2) Once you have collected the material, you can renew the resident permit up to a month before it expires (i.e., if the permit expires August 31, you cannot go and renew it before July 31.) Go to the Exit-Entry Administration Bureau of Shanghai Public Security Bureau at 1500 MinSheng Road. Go to 3rd floor of building.
3) Take an appointment ticket (use the first option titled "签证") from the machine to your left when you reached the top of the escalator.
While you wait, fill out the application form. If you want to know what information the applicatoin form requires -- search for "VISA STAY PERMIT RESIDENCE PERMIT APPLICATION FORM 外国人签证证件申请表" online.
If you took too long to fill out the form and your ticket number has passed, get a new ticket.
Otherwise, wait for your ticket number to be appeared on the monitors.
Give the officer your application material
The officer will give you an option of getting the visa/passport by post, or by pickup.
If you prefer to collect by post, go toward the windows and turn left. There's a little area that's somewhat hidden away. You can get an envelope here.
Fill out the mailing and contact information on the envelope, and pay 25rmb (as of August 2014)
Bring the envelop back to the officer, and that's it!
The officer will give you a receipt. It states the amount of money you will need to pay when you collect your document. It is 800rmb as of August 2014.