When you try to install Microsoft SharePoint Server 2013 on some Windows Server 2012 configurations, the Products Preparation Tool may be unable to correctly configure and install the required Windows Features for SharePoint. If this occurs, the tool will continuously try to configure and install the required features and then restart.
When this problem occurs, the Products Preparation Tool does not progress past the “Configuring Application Server Role, Web Server (IIS) Role” stage.
To work around this issue, use one of the following methods in this article http://support.microsoft.com/kb/2765260, in my case, i used Method 2 – offline method
Also, please to note that: Currently, Microsoft SharePoint Server 2013 is not supported for installation on computers running the Windows Server 2012 R2 operating system. SharePoint Server 2013 with Service Pack 1 and SharePoint Foundation 2013 with Service Pack 1 will offer support for Windows Server 2012 R2.
for more information about SharePoint support for Windows Server 2012 R2, read the following articles:
SharePoint 2013 Support for Windows Server 2012 R2
Microsoft Support: SharePoint 2013 support for Windows Server 2012 R2
I Hope this useful for you,