Note: in this answer, I'm primarily talking about the English Wikipedia, because that's the one I'm most familiar with. This answer may not apply to other Wikimedia Foundation projects, and especially not to Wikimedia Commons, which is it's own minefield of copyright- and licensing issues.
This answer comes in three parts: legal, technical, and policy.
The problem is that anything you contribute to Wikipedia is irrevocably licensed under the CC BY-SA 3.0 and the GFDL licenses, and both of those licenses require attribution. That means that anyone who wants to use your contributions for anything (including Wikipedia itself showing your contributions), must be able to give you credit for your contributions. That means that legally speaking, your account can not be deleted.
Within the MediaWiki software, each action (edits, page creation/deletion, changes to page protection levels, account creation and blocking, etc.) must be attributed to a user, either a registered username or an IP address. There is apparently some discussion about an extension that could allow users to delete their account, but it doesn't look like there's consensus from either the community or from the technical team about how it would actually work. (And that discussion has been open since December 2011 with a total of 34 comments, so it doesn't look like it's a huge priority for anyone.)
According to English Wikipedia guidelines, you can request a Courtesy vanishing. This means that your username will be changed to a string of random characters, and your userpage and all subpages will be deleted. Due to account unification, this name change will be global, on all Wikimedia projects. What will not be deleted is anything you contributed, but it will now be attributed to your randomised username. However, your old username will still show up on talk pages where you signed a message (using four tildes: ~~~~). Do note that courtesy vanishing is just that: a courtesy. It may be refused for any reason (though I don't think it usually is, especially if you're not involved in any kind of dispute or sanction).