This has been discussed for years by Sherlockians, with varying degrees of creativity, complexity and brilliance. As CalMeacham said, Baring-Gould’s work, long considered the ‘Bible’ of the Holmesian world, does present a clear solution. IIRC it is a bit convoluted, but my copy is currently boxed up from a recent move so I can’t check. Instead I’ll move onto what I could find in my notes.
The simplest solution involves four mathematical operations, two multiplications and two divisions, and knowledge of how many yards are in a mile and how many seconds in an hour. The multiplications even I can do in my head and as for the division operations, while fairly cumbersome, I would be willing to believe that many of the Teeming Millions could do them as well.
Part of the assumption is that Holmes supposedly ‘glanced’ at his watch and did not keep track for too long. Mort Furd could be right that he viewed for 3 minutes, but that isn’t an elegant solution and does not allow us the precision necessary. The other necessary ability, which is easy enough, is to be able to look at the second sweep hand of a watch (presumably a pocket watch given the date of the story) and using peripheral vision, tell when you pass an object with decent precision. Checking this while driving, I figure I can determine the time of passing to within 0.1 - 0.2 seconds.
So, Holmes starts counting while passing a telegraph pole and the second hand ‘click’ coincide and continues to count poles and seconds until they coincide again. He would probably note that they passed 17 poles in 39 seconds. Then for the mathematics -
17 poles x 60 yards/pole = 1020 yards (in 39 seconds)
1020 yards / 1760 yds/mile = 0.58 miles (in 39 seconds)
0.58 miles x 3600 seconds/hour = 2088
2088 / 39 = 53.54 mph
I could not manage all the calculations in my head, but the point of the exercise (for the reader) was to illustrate that Holmes was smart and could do it. You can get similar speed answers for 10 poles in 23 seconds, 14 poles in 32 seconds and 24 poles in 55 seconds.
Then, for rabid Sherlockians (or ‘Holmesians’ on CaptainGeordie’s side of the pond), brilliantly outlined by Dex in http://www.straightdope.com/mailbag/msherlock.html, they begin the discussion of why he would subject Watson to this show of brilliance/egotism, where on which railway line it may have occurred, what page of Bradshaw’s timetable the train in question was mentioned, etc.