Here is some background information
http://reference.sitepoint.com/html/doctypes
http://www.w3schools.com/tags/tag_doctype.asp
http://www.htmlcodetutorial.com/document/_33nDOCTYPE.html
In essence, it is all about conformance to rules of writing HTML code. You can get away with not having any declaration, but as you add more advanced stuff, the declaration plays more and more of a role. As you get more proficient, you are likely to use a web authoring tool, which adds these declarations by defaulst.
I quote from the first link:
The doctype contains a lot of information, none of which you will be likely to find yourself being tested on in a job interview, so don’t worry if it all seems too difficult to remember.