Why and how are some questions deleted?

Questions that are extremely off topic, or of very low quality, may be removed at the discretion of the community and moderators.
Over time, closed questions that are not useful as signpoints to other questions may also be removed, as well as questions which have no significant activity over a very long period after being asked. If you want to improve a question to keep it from being deleted, click the edit button beneath it. See How to Ask for more tips on improving questions.

Users can delete their own questions if the question:

has zero answers

only one answer, but that answer has no upvotes

Simply click the delete link underneath the question.

Questions can also be deleted by the community. Moderators can delete any question, and users with sufficient reputation can cast delete votes on closed questions. It takes 3 votes, minimum, to delete a closed question. However, the number of delete votes required scales to the number of votes on the question and all its answers. Questions that have been closed within the past 48 hours cannot be deleted, so as to allow for editing and possible reopening.

Additionally, any answer that accumulates enough offensive or spam flags will be automatically deleted.

What happens when a post is deleted?

Once a post has been deleted, it will disappear for all users except developers, moderators, and users with over 10,000 reputation. Deleted questions will also always be visible to their authors, regardless of the author's reputation. However, deleted posts can be undeleted by casting undelete votes. Once a post has 3 undelete votes, it will no longer be deleted.

Self-deleted posts can be viewed, edited, and undeleted by their original authors.

Please note that deleted questions do not appear in search results, so if you wish to later undelete a question that you've deleted you must have saved the URL somewhere.