Here's what Wikipedia says:
Assimilative palatalization
Paired consonants preceding another consonant often inherit softness from it. This phenomenon in literary language has complicated and evolving rules with many exceptions, depending on what these consonants are, in what morphemic position they meet and to what style of speech the word belongs. In old Moscow pronunciation, softening was more widespread and regular; nowadays some cases that were once normative have become low colloquial or archaic. In fact, consonants can be softened to very different extent, become semi-hard or semi-soft.
The more similar the consonants are, the more they tend to soften each other. Also, some consonants tend to be softened less, such as labials and /r/.
Softening is stronger inside the word root and between root and suffix; it is weaker between prefix and root and weak or absent between a preposition and the word following.
-- Before soft dental consonants, /lʲ/ and often soft labial consonants, dental consonants (other than /ts/) are soft.
-- /x/ is assimilated to the palatalization of the following velar consonant: лёгких [ˈlʲɵxʲkʲɪx] ('lungs' gen. pl.).
-- Palatalization assimilation of labial consonants before labial consonants is in free variation with nonassimilation, that is бомбить ('to bomb') is either [bʌmˈbʲitʲ] or [bʌmʲˈbʲitʲ] depending on the individual speaker.
-- When hard /n/ precedes its soft equivalent, it is also soft and likely to form a single long sound (see gemination). This is slightly less common across affix boundaries.
In addition to this, dental fricatives conform to the place of articulation (not just the palatalization) of following postalveolars: с частью [ˈɕːæsʲtʲjʉ]) ('with a part'). In careful speech, this does not occur across word boundaries.