The SOLE purpose of a doctype for HTML is for Internet Explorer.
This "layout mode switching by doctype" was first proposed for NGLayout in Netscape 5 ~1998, but first implemented in IE5/Mac ~2000. It's now used by all browsers to switch layout mode as I pointed out above.
The so-called "HTML5 doctype", as someone else said, notice there is no "5" in there. While it's allowed to use lowercase 'doctype' in this new version, uppercase was always required in the past and still works and validates with the new version.
The HTML doctype declaration is not case sensitive, so either way is fine.