1. A method of optimizing polarization of an illumination of a pattern to be formed in a surface of a substrate, the illumination originating from an illuminator plane comprising individual pixels from which light illuminates the pattern for being projected via a projection system in the surface of the substrate, the method comprising the steps of: (a) selecting a plurality of fragmentation points in the pattern; (b) determining an illumination intensity for at least one pixel in an illuminator plane for at least two polarization states; (c) determining an image log slope at the fragmentation points at substrate level for the at least one pixel on the illuminator plane for the at least two polarization states; (d) determining a minimum image log slope (ILS) for the fragmentation points for each of the at least two polarization states; (e) selecting an optimal polarization state for the at least one pixel in the illuminator plane that maximizes the minimum ILS; and (f) repeating steps (a)-(e) for each of a plurality of pixels in the illuminator plane.