The circuit detects an error, by producing a measurement outcome representing a syndrome that indicates which of three blocks of three qubits was affected by a phase error (or that indicates that no phase error occurred). Once you know this, you still have to correct the phase error if there was one, by applying a phase flip to any one of the three qubits in the affected block.
The context here is that you've already corrected for a possible bit flip error, so that the input to the circuit is a state that resulted from at most one phase error being applied to a vector in the code space of Shor's 9 qubit code. Vectors in this code space look like
$$
\alpha |\phi_0\rangle |\phi_0\rangle |\phi_0\rangle +
\beta |\phi_1\rangle |\phi_1\rangle |\phi_1\rangle,
$$
where
$$
|\phi_0\rangle = \frac{|000\rangle + |111\rangle}{\sqrt{2}} \quad \text{and} \quad |\phi_1\rangle = \frac{|000\rangle - |111\rangle}{\sqrt{2}}.
$$
A phase error on the first block (i.e., qubit 1, 2, or 3), for instance, would result in the state
$$
\alpha |\phi_1\rangle |\phi_0\rangle |\phi_0\rangle +
\beta |\phi_0\rangle |\phi_1\rangle |\phi_1\rangle.
$$
Now, the reasoning behind the circuit is that applying Hadamard gates to each qubit of $|\phi_0\rangle$ gives a uniform superposition over even-parity strings, while applying Hadamard gates to each qubit of $|\phi_1\rangle$ gives a uniform superposition over odd-parity strings. Each set of three controlled-NOT gates will therefore induce a bit flip on one of the syndrome qubits when the three corresponding qubits are in the $|\phi_1\rangle$ state but not in the $|\phi_0\rangle$ state.
So, in the example suggested above where a phase error touched qubit 1, 2, or 3, the first six controlled-NOT gates have the combined effect of flipping the second syndrome qubit, while the remaining controlled-NOT gates collectively do nothing. This results in the syndrome 01, which indicates a phase flip in block number 1 (i.e., the first three qubits). You can check that a phase error in a different block gives an appropriate outcome, and that if no phase errors occurred, the syndrome 00 is obtained, indicating no phase errors.
Note that this does not entangle the syndrome qubits with the other qubits, so when you do all of the Hadamard gates again, you recover the original input state. Of course this assumes an input of the special form described above; if you put in an arbitrary state, you might very well end up with something entangled with the syndrome.