The urine and bile are the 2 main ways of drugs excretion, other ways are tears, saliva, sweat and lungs (gases, vapors and alcohol). Drugs that are excreted in the urine or bile are mostly water-soluble (polar). Usually when a drug is initially absorbed it goes through the liver (first pass) after conjugation it is excreted through bile (I'm only talking about bile excretion here). Metabolites of certain drugs are excreted into the intestines and then commonly undergo Hepatic Cycling (hyrdoconjugation) which then reabsorbs it back into circulation for a second time which tends to decrease the net excretion of this route. Pertaining to your question now, what you are asking is basically:
What Factors determine the process of elimination?
Answer:- Great question and very clinically relevant also. From my knowledge the factors are chemical structure, polarity and molecular size that determine it all.
IF a drug is fat-soluble, a small particle, basic in nature, easy to absorb, chances are it's getting metabolized and excreted by the liver and is possibly hepatotoxic at high levels.
IF a drug is water-soluble, a large particle, acidic in nature, hard to absorb, chances are it's being renally excreted and at high doses possibly nephrotoxic.
The clinical correlation is basically if a drug has a long half life it will most likely be fat-soluble and so on and so forth but I won't be explaining that since this is for Step 1. Don't get bogged down into the minute details.
Hope this helped clear things up. Msg me if you still want the clinical details also.