。
I decided to consult a lawyer.
Literal
Lawyer [with-に] consult [nominalizer-こと] [into-に] did.
~ことにする is the canonical 'decide to X' construction — literally 'do it into the fact of X-ing,' with こと nominalizing the verb and に + する transforming a situation into a decision. Contrast with ~ことになる, which is 'it has been decided (passively) that X.' 相談する takes に for the person consulted (or と for a more mutual consultation).