Polarimetric imaging mode of VLT/SPHERE/IRDIS. I. Description, data reduction, and observing strategy