Well, at the very basic level it works just like traditional cladistics (i.e., based on morphological data).
So, for example, a sequence of a given gene is obtained for different species and the number of transformation in the sequence required for every possible phylogenetic tree is calculated. The phylogenetic tree that requires the lowest number of transformation is the more parsimonious and, thus, it is the best phylogenetic hypothesis.
This is a very simple explanation, and it is not considering more complex procedures such as maximum likelihood, etc..
Cladistics, or phylogenetic systematics, is an arrangement of grouping living and terminated creatures dependent upon evolutionary family as controlled by bunching taxa consistent with "inferred characters," that is qualities or characteristics imparted particularly by the taxa and their regular precursor.