Of course, if resources are scarce and speed critical, said depth should be determined through benchmarking, but here are some maths to help cornering it.
Let us assume that we are dealing with n object for which we have to trace collisions, that their repartition in the world is uniform and they are small enough that no matter how fine the grid is, overlap will be negligible. If we use a depth d quadtree, we have 4^d leaf cells, so that's an average of n/4^d objects per cell. If the cost of detecting collisions between N objects is O(N^p), the cost of checking all collisions is
If we rebuild the quadtree from scratch, the cost of dispatching the objects between the cells is 2⋅n⋅d. So the total cost is
c(n,d,p) = 4^(d-dp)⋅n^p + 2⋅n⋅d
So finding an appropriate d should not be hard. Interestingly enough, it is not too dependent on p, for instance for 100 objects and p from 2 to 7, here is a plot c (for real-valued b to make it easier to read)
Here, 3 seems to be a good d. So me mostly have to take n into account. For p=2, the n thresholds I found are
n > │ d
100 │ 3
400 │ 4
1400 │ 5
5500 │ 6
22000 │ 7
87000 │ 8
Again, the numbers are quite crude and the assumptions quite strong. In particular, if you are dealing with non-ponctual objects, you should definitely make sure that size is still small enough with respect to the grid granularity. But it should at least give a order of magnitude.