The Hadamard gate switches between the computational basis and the Hadamard basis. In unitary-identification experiments, this basis change can transform an X gate into a Z gate and make measurement-based distinction possible. section 5.1.1
Distinguishing X from H
Prepare a qubit in |0⟩, apply the unknown gate, apply X, and apply the unknown gate again. If the unknown gate is X, the sequence is XXX = X; if it is H, the sequence is HXH = Z. Measuring the final qubit yields 1 for X and 0 for H. section 5.1.1
Figure 5.2 To distinguish two unitaries in one experiment, we need to choose an initial state that can be converted to different orthogonal states by applying each of these two unitaries, possibly as part of a longer sequence of unitaries. We then run the experiment by preparing that initial state, applying that sequence of unitaries, and identifying which of the orthogonal states we got using measurements.
Use the figure to connect unitary discrimination with state preparation, gate sequences, orthogonal outputs, and measurement. section 5.1.1

