Theory of Kerr effect in magnetic multilayered structures