There are several causes of black nails in runners and non-runners.
The most common among runners is bruising or slight bleeding under the nail from repetitive trauma of the top of the shoe striking the nail with each step or the toe sliding forward into the end of the shoe. This is common in runners training for marathons and highly competitive runners training at high intensity and volume. These nail injuries are generally not painful, though sometimes the nails do thicken. They will heal when the training volume and intensity decreases, and the repetitive trauma ceases. A shoe with adequate toe room will also help in some cases. (Note: Drilling a hole into the nail to "drain" the blood will not help this problem, and may hurt!)
Subungual hematoma is less common but more painful. It's the result of trauma to the nail area (like being stepped on, or dropping a heavy object on the toe) that causes blood to accumulate under the nail. The pool of blood produces pressure and often severe, throbbing pain.
A subungual hematoma does require making a hole in the nail, to decompress the blood pool and relieve the pressure causing the pain. This is best left to your physician.
There are other causes of black toenails to consider. One is fungal infection that can thicken the nail and sometimes turns the nail dark, almost black. This can be treated with oral antifungal medications over six months' time. The thickened nails can be painful but generally are not throbbing.
Finally, a black spot under the nail can be a melanoma. If you have a dark spot under the nail that does not go away, have your physician check it.
One tip regarding nail polish: It is tempting to hide black nails with polish. While this does improve the look of the nail, it does not allow the nail to breathe, and you may risk losing the nail.