"Leave to enter" is short for "Leave to enter the United Kingdom". It is defined in Section 3 of the Immigration Act 1971...
Six months was initially selected as the maximum amount of leave that can be given to a non-visa national because that interval ties in to lots of other legislation rooted in English common law where the interval of six months plays an important part.
In the Immigration Act 2014, the usage of six months is explicit per Appendix V...
A visitor is a person who is coming to the UK, usually for up to six
months, for a temporary purpose, for example as a tourist, to visit
friends or family or to carry out a business activity.
How is the six months counted? Is it a number of days or is it six calendar months regardless of the number of days in each month?
Days have nothing to do with it. Sometimes six months can be 181 days or more and other times it can be 179 days or less. You add six months to the date on your leave to enter and that's your expiry date.
The counting method for corner cases where the person arrives on the 31st of the month is the final day of the 6th month. Examples: People granted leave to enter on 31 Aug 2015 should be gone by midnight 29 Feb 2016. But consider that people granted leave to enter on 28 Feb 2015 should be gone by midnight 28 August 2015.
However, it is not carved in stone. People have tried taking some of these corner cases to court and have achieved mixed results depending upon what they were trying to accomplish. I have also seen a case where a silver-tongued individual was able to out whittle an official on a corner case and avoid an overstay penalty.
Any ambiguities are built into the law from a long, long time back and they are not likely to become more precise in the current era because 'six months' has a lot to do with a lot of things in the legislative framework. If you think you are in a corner case, it is best to query the IO on arrival what your expiry is.
Related: How should I express the end of a period of time I'm allowed to stay in a country so as not to confuse it with visa expiration?
See also: Leave to enter
See also: Administrative Provisions as to Control on Entry etc.