A theory is presented for core hole polarization probed by spin polarization and magnetic dichroism in resonant photoemission. The resonant photoemission is considered as a two-step process, starting with an excitation from a core level to the valence shell, after which the core hole decays into two shallower core holes while an electron is emitted. The two core holes form well defined states which can be selected by the energy of the emitted electron. The non-spherical core hole and the selected final state cause a specific angle and spin distribution of the emitted electron. The experiment is characterized by the magnetic and nonmagnetic moments being measured, the polarization and direction of the light and the spin and angular distribution of the emitted electron. The intensity is a sum over ground state expectation values of tensor operators multiplied by the probability of creating a polarized core hole using polarized light, multiplied by the probability for decay of such a core hole into the final state. Using diagrammatic methods we derive general expressions for the angle and spin dependent intensity in various regimes of Coulomb and spin-orbit interaction, LS, LSJ and jjJ coupling. This core polarization analysis generalizes the use of sum rules in x-ray absorption spectroscopy where the integrated peak intensities give ground state expectation values of operators such as the spin and orbital moments. The photoemission decay makes it possible to measure new linear combinations of operators. The general formula for second-order processes shows that in the presence of core-valence interactions the two-step model may break down due to interference terms between intermediate states separated by more than their lifetime width. We present tables for the resonant p core hole decays in 3d transition metals. The 2p3/23p3p decay in ferromagnetic nickel is calculated using Hartree-Fock values for the radial matrix elements and phase factors. Recent measurements show an effect which is smaller in the 3P final state but stronger in the 1D, 1S peak. Spin polarization is due to odd moments of the core hole. We discuss and plot angular distributions and suitable geometries for spin polarized detection.