Official Documentation: https://docs.joomla.org/How_to_override_the_output_from_the_Joomla!_core
When components and modules have Joomla set their own layout path automatically, it opens up the opportunity for end users to override the layout file with your own custom output.
The most basic and most common way to do template overrides is to copy the layout file for a component or module into your template's html folder (just make it if it doesn't exist) and then modify the file how ever you want. If you upgrade the exention there is no guarentee that your layouts wont break or be missing some new feature so it's best to check for differences after upgrading and keep your changes neat so they may be easy to replicate.
The directory structure you need is:
For example, if you want to change the way that the 'Article' view displays a com_content article, then you should copy the file at :
(note the slight difference in directory structure)
Similarly, if you want to change how the mod_login Module is displayed, then you should copy :