How to install a arbitrary version of iOS on iPhone? I have to develop an app for a specific version of iOS (I am just a freelancer, doing what I am told).

How I install iOS 8.2, or below (8.1, 7.x are fine too) on an iPhone 4S?
There's no official way of installing an older iOS on a device that Apple has stopped signing the SHSH keys for.

Your best bet is either to get a hold of a device that still has an older iOS or just using a simulator when developing the app.