Apple - Removing app from iOS app store and notifying users that the app is no longer supported
However you want to notify your users is up to you. Doing so is not a technical question but more of a choice of whatever's easier/faster/convenient for you. If you have the ability and desire to notify users before you shut down, my suggestion is to do that. Users might not be happy with losing use of the app but at least you'll have the respect of knowing that you gave everyone ample notice.
There is no customary procedure because every app and user-base is different. I would also recommend contacting your users with every method you have available. If you can popup a message, do that; if you can send an email, do that; if you can post to Twitter/Facebook, do that. There's no way to overcommunicate an app shutdown.
The only thing I would recommend against is creating an app update that just shows a message about the app shutting down. Users will feel tricked and you'll have a mess and lost of confidence.
If users can still use your app without any further updates from you or without your backend services, let them use it. Once you remove the app from the App Store, users will not be able to restore it from backup; once it's gone, it's gone.
UPDATE: Per discussion in the comments to this answer, there appears to be a difference between restores done via iCloud and iTunes. @Hitechcomputergeek points out iTunes can back up actual apps, while iCloud only backs up their data and re-downloads the app itself from the App Store (like if you had first downloaded it).
Putting a new version on the store is the nicest way I've seen as well as getting the word out.
Some very well respected examples of this currently are:
It does depend on your budget and time frame. You can push a metadata only update and ask for expedited review and explain why you'r pushing the update and it should be live in a matter of days - sometimes hours.
You'll get a lot of bad reviews, but you were expecting that anyhow unless there's a good migration path for end users to crowd fund or get their data.
I would then pick a date where no new downloads happen, but give end users 6 months to a year before you pull it entirely from the store. No new sales, clear expectations, options and not yanking the app seem the most gentle and kind way for an arbitrary / general app to close up shop.