Firstly, there is no way that you will not appear in a bad light here. You promised to do something, you were unable to do it - people will be somewhere on the scale of disappointed to angry.
There are two things that you need to do in a situation like this:
- You need to acknowledge and report the fact that you did not meet the deadline
- You need to change the way you work so that this does not become a regular occurrence.
Acknowledge and report
You need to do this as soon as possible. If you're close to finishing, but have the very final part left, and you're realizing that you won't be able to manage the rest - send what you have and explain why a part is missing. If I were the recipient, I'd rather have 95 % of a report than 0 %. If you literally fall asleep at your desk before hitting "send", you should send it with an apology as soon as you wake up.
Change the way you work
This is the most important part. If missing a deadline was a one-off occurrence, an apology and an assurance that "it won't happen again" would be sufficient. But it's not - you repeatedly find yourself in a situation where it's not possible for you to meet a deadline. This means that you need to change your work patterns. I can't tell you exactly how to do this, but here are some suggestions to consider. But first, talk to your manager. Explain that you are having problems with tasks requiring you to put in very long days to the point that you literally are unable to finish due to lack of sleep. Ask them to help you change the way you work so that you can deliver your product on time. You will need their support to fix this, and your fixing it will reflect well on your manager.
- When you get a request with a deadline which will require you to work late, say no. Explain that it is not possible to meet this deadline, suggest that you can do X percent of the work within that deadline and you'll turn the rest in within Y days. This is something you really need your manager's support with; if they don't back you up, you're sunk.
- If you often have the kind of jobs that are given to you late in the day and will require you to work after hours due to timezone issues with other departments, talk to your manager about adjusting your hours so that you can start later. That way, if you need to work until 10 pm, at least you will have been able to sleep in a bit first.
- When you do need to work late and are tired, set up a reminder to yourself to send the work in at a given time, whether finished or not.
- Send the work in in increments. It's better for the recipient to have part of the work than none of it.
- EDIT If you need to deliver something at, say, 2 am, then don't start working on it immediately when you get home from work. Instead, have your dinner and get an hour or two of sleep. You will be a little more rested and you will be more efficient and effective at your work.
As a sysadmin, I've occasionally had work to do that could only be begun after business hours and that needed to be finished before a set time. On those occasions, I would get to start late in the day so I would be well rested when work started, and I would not be expected to be in until the following afternoon. I would also know that restoring the service would take e.g. 30 minutes, so I would not continue working with the job too long - I would always make sure that I wrapped up the job (even if unfinished) in sufficient time that I would be able to spend those 30 minutes to get the service back online. I would also plan for the time to send my report to my manager and anyone else concerned, and I'd take the time to jot down notes during the work so that I didn't have to formulate the entire report after the work was done.
Oh, and also remember to eat properly - coffee and sugar isn't sufficient, you need actual food to keep going. Eating something with actual protein and fat will keep you focused a lot better than three cups of coffee.