That happened to 2 of my dogs. One of them just needed it clipped back and he was put on antibiotics because it got infected. The other one had to get it pulled out at the vet under anesthesia because it split all the way to the pad. He was put on antibiotics and pain pills. His nail hasn't grown back fully yet because it happened a couple of weeks ago. The vet told me it should be back to normal in 6 months (fully grown out).
It depends on whether the nail bed has been damaged or not, so have your vet take a look at it. It may just need to be clipped back and allowed to grow back out again. My dog completely pulled out an entire nail years ago, and we thought it was gone forever. When it grew back, the nail itself was normal, but a bit cockeyed due to displacement of the nail bed. Oh well - it worked for him! :-)