I'm not an expert on this stuff, but I've compiled some tips over the years. The spring preload sets the ride height of the bike and determines how much of the total travel will be available for compression and how much will be available for extension. Damping keeps the bike from behaving like an old Cadillac - i.e., still bouncing 10 seconds after hitting a bump.
Compression damping slows the shock when it is being compressed.
Rebound damping slows the shock when it is rebounding. Start at the shock manufacturer's recommendations. Only change one setting at a time, and don't change damping more than 2 clicks at a time. For compression damping, increase until expansion joints or sharp bumps are jarring, then back off one click. Don't forget that when you increase preload, you have to increase rebound damping and vice versa for decreasing preload.