You might have had second thoughts about something you've posted. Maybe you don't want your coworkers to see that very specific question about job-hunting, or you realize you shouldn't have posted that proprietary code, or you don't want your friends to see that stupid mistake in your question. If nobody has answered yet, go ahead and delete it — nobody minds.
If your question has good answers, though, it's not fair to have those answers removed along with your question: other users put effort into helping you and even if you no longer want the answers, somebody else might. This is why the system prevents you from deleting answered questions most of the time.
But there are some other things you can do:
If your question is unnecessarily specific, edit to generalize it. Do you really need to name specific employers, vendors, or other details? Is your location actually important? Can you make the code more generic and rename some variables? Don't invalidate existing answers and don't make it so vague as to be unanswerable, but if you could be one of thousands of people who could have asked that question, people probably won't know it's you. In almost all cases, an edit should be all you need.
If you really can't see a way to salvage the question while removing identifying details, and none of the answers are highly upvoted, and especially if the question is closed, you can use a flag to request that moderators delete it. If there's not much at stake, they might do that for you.
If you have posted something super-sensitive like a password or an API key, edit it out and then use a flag to ask moderators to redact it from the revision history. Be specific about what needs to go and (if it's not obvious) why. Redaction requests must be approved by two moderators, so there will be a delay. If the question is closed, moderators might decide to just delete it instead. See this post for some more specific guidance on preparing a post for redaction without breaking it or its answers.
If the question is good, there's nothing sensitive in it, and the problem is just that your name is on it, you might be able to have it disassociated from your account. This is not true anonymity; anything you post on the Internet lives forever somewhere. Requests are reviewed, which takes time. If your request is approved, it cannot be reversed later.
While redaction and disassociation are permitted, they are meant to be rare exceptions, not routine actions. A pattern of posting rashly and requesting deletion, redaction, or disassociation, over and over again, could lead to suspension. Post as if everything you write will be publicly visible forever.
Vandalizing or excessive deletion of useful posts may trigger an alert within the system, and prompt action from the moderation team. Please be respectful of the efforts of others: avoid invalidating their work or creating a nuisance.
None of this can be used to lift a posting block by the system — if you are blocked from posting new questions or answers, please refer to Why are questions no longer being accepted from my account? and Why are answers no longer being accepted from my account? for guidance on how to lift the block.