For a sparingly soluble salt XmYn(s)⇌mXn+(aq)+nYm−(aq), the solubility product is Ksp=[Xn+]m[Ym−]n -- the product of the constituent ions' molar concentrations, each raised to its stoichiometric coefficient, once the solid's own (constant) concentration is absorbed out of the equilibrium expression.
Predicting precipitation. Computing the same expression with the actual ion concentrations present (whether or not the solution is at equilibrium) gives the ionic product; comparing it to Ksp predicts the outcome: ionic product >Ksp means the solution is supersaturated and precipitation occurs; ionic product <Ksp means the solution is unsaturated (no precipitate); ionic product =Ksp means the solution is exactly saturated, at equilibrium.
Relating Ksp to molar solubility. If s is the molar solubility of XmYn, then [Xn+]=ms and [Ym−]=ns, so Ksp=(ms)m(ns)n=mmnnsm+n -- e.g. for a 1:1 salt like BaSO4, Ksp=s2; for a 2:1 salt like Ag2CrO4, Ksp=4s3.
Common ion effect on solubility. When a soluble salt supplying one of the same ions (e.g. NaCl added to a AgCl suspension, both supplying Cl−) is already present, Le Chatelier's principle pushes the sparingly soluble salt's own equilibrium back toward the solid -- so its molar solubility in the common-ion solution is lower than in pure water. In that case the dominant ion concentration is set almost entirely by the added common-ion salt (since the sparingly soluble salt's own tiny contribution is negligible by comparison), simplifying the Ksp expression to a single unknown, the reduced solubility.