Relaxation and final-state structure in XPS of atoms, molecules, and metals