The first step is to observe them and then react to their often unbalanced tendencies. Very few payers are balanced, but with the unpredictable ones, it can take a little longer to know how to best exploit them.
Keep your cool, stay patient, and don’t deviate from your game plan just to fight chaos with chaos.
Look at their hands as they play with other players and see if they have the same tendencies against them as they do with you.
Showdowns give the most information often.
In live play, you also try to put up reads that can give you extra clues to some patterns.
Nothing wrong with being a little tight and passive and keeping the pots small until you think you have figured out what type of player you are up against. Go to some cheap showdowns in the beginning as often as possible.
Position is always important, but against unpredictable players, it's extra important because you can control the pot size and the number of streets that money goes in more easily. That also helps with going to showdown cheap with marginal and/or weak hands.