When you try to install SharePoint 2013 on Windows Server 2012 you need to install he prerequisites before SharePoint 2013.
You may get this error.
And when you open the log file, you will see the below error
Error when enabling ASP.NET v4.0.30319
Go to Server Manager >> add roles
Select Web Server (IIS)
Pass the Features and Web Server Role (IIS)
You may need to restart the server after above changes