Sorry to hear that, man.
Epilepsy just means you've had more than one unprovoked seizure in your life. You already knew that, so it's just referring to what you've already been through by a new name.
The easiest way to determine the cause of your epilepsy would be to dissect your brain. Most people find this unpleasant. But the cause in most cases is a microscopic malformed circuit in the brain. These most likely occur during fetal development - a family history makes this more likely to occur, but is by no means necessary. Sometimes the signature of these can seen on an MRI, but not typically. This can also be identified through invasive monitoring, which involves sticking electrodes on the surface of the brain. This is typically reserved for cases where epilepsy surgery is being considered, in which the problem area is taken out of the brain (a very effective procedure, but for obvious reasons is reserved for cases where frequent seizures persist in spite of medication).
The mechanism of action of many of the anti-epileptic drugs is well established. The precise mechanism of some, particularly the new agents, is not (I'll take a guess that the medication you were prescribed was Keppra). Though they clearly reduce seizure frequency.
For kids with terrible, impossible to treat epilepsy, the most effective solution is a ketogenic diet. It outcompetes any drug. It's only done in extreme circumstances in kids, and isn't recommended to adults because it's considered "unhealthy". Folks here know this to be false. If I had epilepsy, I'd try to stay in ketosis.