X-ray selected quasars and Seyfert galaxies - Cosmological evolution, luminosity function, and contribution to the X-ray background