When you get hard enough and it knocks you out, it makes your brain hit the inside of your skull. While this is happening you a quick flash of darkness envelops the senses as the body shuts itself down and does a quick reboot. The quick flash of darkness is when you see "stars".