This is a typical strong arm dynamic latched comparator with preamplifier - there is a huge number of papers/textbooks threated on it.
In short: preamplifier is used to reduce kick-back from latch to input, capacitors are used to trim dynamic offset. Offset is caused by unequal capacitances at drains of 2nd stage input pair (caused by mismatch and parasitics). During comparison stage (when CLK signal is high), drain nodes of input pair are charged and basing on this charge, latch "makes a decision" to set proper output values.