Well, there's a few theories out there:
1) Driver length is irrelevant. Due to the low loft, having the club seriously toe up or down doesn't really effect anything. Play a length that's comfortable.
2) The USGA (and R&A) allow a maximum driver of 48". Since that's the max allowed, play it.
3) Using a Wrist To Floor (WTF) measurement, your ideal clublength is calculated using a standard chart.
4) Using a Wrist To Floor (WTF) measurement, your ideal clublength is calculated using a complex spreadsheet, based off an ideal golf setup position and the known lie angle of the club.
5) Demo like crazy. Hit progressively shorter drivers until you find a length that you can hit the fairway with 8/10 times. Or, start with shorter drivers and hit progressively longer ones until you dip below 8/10.
I use Option 4 (aka TrueLength Technology -
http://www.danscustomgolfshop.com/truelength.html), and love it.