DOCTYPE is not needed, it's an optional element of a web page (not ASP, PHP or other) and only helps the browser to render and use proper rendering mode.
The doctype declaration is not an HTML tag; it is an instruction to the web browser about what version of the markup language the page is written in.
As you mention you're a beginner, the HTML code (the code that is rendered in any web browser) is divided in 2 main areas.
<html>
<head>
// Everything here is to help the browser to display the correct design
</head>
<body>
// Everything here will show in the user display
</body>
</html>
the <doctype>
that is added adove the <html>
tag represents "Hey Browser, this how I made my code, please follow the standards of this type"
It's the same as you see a Navy Officer with it's patent on the shoulders... It's an optional thing to have (in the civil world) but if you see someone wearing it, your approach to that individual will be very different and many you don't say: "Wazz'up" but "How do you do".
It's all about standards.
<doctype>
it's only come important with more ways to render the same things in the user browser, in 1990 all we knew was <html>
and there was no difference between <br>
and <br />
, even today, the browser render engine does not care about the breaking space tag, but other might, as <img alt="" src="" >
and <img alt="" src="" />
Then, there is the difference between HTML and XHTML, though they are an XML language variants, XHTML is much more restrict and, for example, all tags need to be closed, so you do need to write <br/>
.
I hope I can help you make some sense on the <doctype>
tag :)