There is no known general algorithm to choose which way to apply L'Hospital's rule. Sometimes $\rm\: N'/D'\:$ works and sometimes $\rm\: (D^{-1})'/(N^{-1})'\:$ works. If you iteratively try both cases then you get combinatorial explosion: $\rm\:2^k\:$ possibilities upon $\rm\:k\:$ successive applications of the rule (not to mention possibly intractable intermediate expression swell with expressions that grow under differentiation, e.g. exponentials). There are some heuristics that sometimes help in practice, e.g. see the papers below on early heuristic approaches to computing limits in computer algebra systems.
D. Gruntz. On Computing Limits in a Symbolic Manipulation System.
Steven J. Harrington. A symbolic limit evaluation program in REDUCE.
Jean-Pierre Laurent. A program that computes limits using heuristics to evaluate the indeterminate forms.
However, there are effective algorithms for computing limits of large classes of elementary and special functions. They do not employ L'Hopital's rule. In fact I devised the first known algorithm when I was an MIT student. It employs a sort of generalized power series expansion in terms of certain asymptotic kernels (technically it employs differential valuation theory in Hardy-Rosenlicht fields). For an introduction to similar ideas see G. Edgar's Transseries for beginners.
Below is an example of my (Macsyma) algorithm computing (my generalization of) a limit suggested by Rich Schroeppel, who - not believing in the existence of an algorithm for limits - designed a monstrous expression in an attempt to thwart the algorithm 