A black eye is usually the result of an injury to the face or head. What happens is that blood and fluids collect in the space around the eye causing the swelling and dark discoloration that we are all familiar with.
Most black eyes are minor injuries and will go away on their own within a few days. The best initial treatment for a black eye is the application of ice. DO NOT apply raw meat like they do in the movies, this can easily promote infection.
Sometimes though, a black eye is the result of a more serious injury, and it needs to be seen by your eye doctor.
If the black eye is accompanied by changes in vision such as double vision, or you are experiencing severe pain, or swelling that does not go away, contact your doctor right away.
If you have any questions, it is always better to err on the side of calling your doctor.