Came upon a usecase where a developer needed to know which version of SharePoint was running to determine if he needed to load client assemblies for SharePoint 2010 or SharePoint 2013.
TL;DR
SharePoint always tell you which version it is by a custom header in the web reponse when performing a GET request towards the SharePoint site.
By simply calling the SharePoint root site or any other SharePoint site for that reason you get the versionnumber in the responseheader. ("MicrosoftSharePointTeamServices") This is not a reliable way of finding out the real buildversion but enough to determine which version of SharePoint.
SharePoint 2010 = 14.x, SharePoint 2013 = 15.x and SharePoint 2016/Online = 16.x