Using SV_SampleIndex in your pixel shader (or alternatively using the "sample" modifer on a pixel shader input attribute) will cause the PS stage to run at "sample rate" instead of "pixel rate" (note that it actually has to be used by the shader, and not optimized away). When running at sample rate, the pixel shader will be run for every sub-sample in the pixel. So if you have 4xMSAA enabled, you will end up with at least VPWidth * VPHeight * 4 pixel shader invocations. This allows you to output a unique value to every sub-sample, suitable for things like 4x super-sampling. Otherwise the pixel shader will be run once for every pixel regardless of the MSAA mode, and will output the same value to all sub-samples covered by the coverage mask (which is determined by testing if the triangle covers the sub-sample position).
Another related feature is SV_Coverage, which lets you specify the bitwise coverage mask that should be used when outputting the pixel shader value to MSAA sub-samples. The value of SV_Coverage is AND'd with the coverage mask produced by the rasterizer before writing the PS output to the render target, which as an example can be used to only write a value to the first sub-sample of each pixel.