How can I determine a maximum run length for CANbus?
I mainly depends on your required bit rate.  CAN works by the transmitter node checking that its bits are correctly on the bus.  There are two reasons in the protocol that this intentionally doesn't happen:


If another transmitter is attempting to transmit, it overwrites some of the bits, and the lower priority message is held up.
Receiver nodes can flag errors by overwriting bits.


Therefore, the total delay in the bus (including the delay through the PHY and controller at both ends, wiring delay and any opto-isolators) needs to be significantly less than the bit time.  Often the sampling point of the receivers (including the one in the node which is currently transmitting) is set up to be about 70% of the bit time, so you want your delay to be shorter than that.

For example (and this is a quick hack calculation with approximations in), a 500kbit/s bus has a bit time of 2us.  

70% of that is 1.4us.  

Assuming 100ns each way through the PHY and controllers, you lose 400ns there, so you have 1us for signal propagation in the wire.  

The signal has to go out and back, so we have to halve that, giving 500ns.  

Rule of thumb for coax propagation is 6 inches in 1ns (ugh, non-SI units, let's say ~6ns/m!).  (As Olin rightly points out, twisted pair will likely be somewhat faster). That would give a bus length of about 85m.  

CiA has some recommendations which seem less conservative than that, although were calculated for a later sampling point (87.5% IIRC):

Bit rate    Bus length       
1 Mbit/s    25 m         
800 kbit/s  50 m         
500 kbit/s  100 m   
250 kbit/s  250 m    
125 kbit/s  500 m        
50 kbit/s   1000 m   
20 kbit/s   2500 m  
10 kbit/s   5000 m