Why have I had trouble falling asleep and staying asleep?

Sleepless. Your question was cut off, but it seems that you have primary insomnia, assuming that you don't drink alcohol or use drugs, and that the problem has been there for a while. Recommend the sleep hygiene techniques (google that sentence & you get details), & if that fails, try low dose melatonin, & if that fails, see your pcp for other alternatives.
Sleep prolems. Possible causes of insomnia include: poor sleep hygiene,Traveling with change in time zones, chronic pain, frequent night-time urination, problems breathing, Shift work, anxiety disorders (esp. PTSD), Depression, bipolar disorder, stress, medications (i.e. stimulants), caffeine, alcohol, eating large amts before bed, aging, restless leg syndrome, sleep apnea, etc.