Lee likes bikes has some good info on this stuff,
There are two basic things.
Air pressure in shock
Tuning the various damping parameters
The first is done by setting the appropriate sag for the kind of riding you do. The sag is the amount of compression in the shock when you are riding on flat ground in your normal
position. The more "extreme" your riding the more sag you want, XC racers aim for about 20%, All Mountain 25%, Downhill 30%. These are just rough places to start.
The shock or fork generally comes with a rubber ring for helping you to set the sag. If it's not there
you can use zip tips for the same purpose. Put the marker at the top of the shock, ride
around the block and record how far down the ring has moved.
Tuning the various knobs is done via bracketing. Ride at the lowest, then ride at the highest, pick which one is better and then repeat the test with one lower, one higher etc.
After 5 years of riding a full squish, I've not really found much benefit in tweaking the various knobs once you get the sag correct. But don't ride at anywhere near the limits of my bike.