Hour

The hour was originally defined in Egypt as 1/24 of a day, based on their duodecimal numbering system (which counted finger joints on each hand).
In modern usage, an hour was redefined as a unit of time 60 minutes, or 3600 seconds in length. It is approximately 1/24 of a median Earth day.
There is also the hour of right ascension, a unit of both time and angle.
Earlier definitions of the hour:
 One twelfth of the time from sunrise to sunset. As a consequence, hours on summer days are longer than on winter days, their length varies with latitude and even, to a small extent, with the local weather (since it affects the atmosphere's index of refraction). For this reason, these hours are sometimes called unequal hours. Romans and Greeks used this definition and divided the night into three or four night watches. Later, the night (i.e., the time between sunset and sunrise) was also divided into twelve hours. When a clock showed these hours, its speed had to be changed every morning and evening (for example by changing the length of its pendulum), or it had to keep position of the Sun on ecliptic (see Prague Astronomical Clock).
 One twentyfourth of the apparent solar day (between one noon and the next, or between one sunset and the next). As a consequence, hours vary a little, as the length of an apparent solar day varies throughout the year. When a clock showed these hours, it had to be adjusted a few times in a month.
 One twentyfourth of the mean solar day. See mean sun for more information on the difference to the apparent solar day. When an exact clock showed these hours, it had to be adjusted virtually never. However, as Earth rotation slows down, this definition has been abandoned. See UTC.
Counting hours
Every definition of the hour came with its own starting point for counting the hours.
 In antiquity, the counting of hours started with sunrise. So, sunrise is always exactly at the beginning of the 1st hour, noon at the end of the 6th hour, and sunset exactly at the end of the 12th hour.
 In the socalled Italian time, the first hour starts at sunset (or the end of dusk, i. e., 1/2 hour after sunset, depending on local custom). The hours are numbered from 0 to 23. So, the sun rises at Lugano in December around 14:46 and noon is around 19:23; in June, the sun rises already at 7:51 and noon is around 15:55. Sunset is always at 24:00. This manner of counting hours has the advantage that everyone can easily read the clock to see how much time they will have to finish their daywork without artificial light. It was introduced in Italy during the 14th century and lasted until the mid18th century, or in some regions until the mid19th century. It was also used in Poland and Bohemia until the 17th century.
 In the modern 12hour clock, counting the hours starts at midnight and restarts at noon. Hours are numbered 12, 1, 2, ..., 11. Noon is always close to 12 PM (post meridiem, after noon), differing according to the equation of time. At the equinoxes, sunrise is around 6 AM (ante meridiem, before noon), and sunset around 6 PM.
 In the modern 24hour clock, counting the hours starts at midnight, and hours are numbered from 0 to 23. Noon is always close to 12:00 (differing according to the equation of time). At the equinoxes, sunrise is around 06:00, and sunset around 18:00.
Sunrise and sunset are much more conspicuous points in day than noon or midnight; starting to count then is much easier than starting at noon or midnight. With modern astronomical equipment (and the telegraph or similar means to transfer a time signal in a splitsecond), this issue is no more relevant.
Sundials often show the hour length and count according to some of the older definitions and countings.
The division of the day into 12 hours dates back to the Sumerians. There are probably 12 hours because there are approximately 12 lunar months in a solar year. Symmetries of this sort are common in ancient units of measurement.