It doesn't necessarily have to have a clean ESN. It should be Unlocked instead. iPhone 5 unlocks cost about $100+. Be careful when you purchase a phone. Check the IMEI on a website and it will tell you "sim lock". You want it to say "unlocked". That is the reason it does not work.
When I run into this problem, usually it has to do with the Charger Port, or the Battery. Replace the battery first. If it is doing the same thing, then it should be the Port. Replace the port and then proceed to charge. Usually fixes it 95% of the time.
Before trying anything, I recommend taking it to the Apple store if you are under warranty. Might get lucky and get a new one for FREE! I took an out-of-warranty water damaged 5 I got from a buddy and paid $300 (with tax) for a brand spanking new one. If that doesn't work, then need a new LCD-Digitizer assembly for the 5. That should fix the black screen.