Lots of factors, genetics alone can account for approx 50%, this is variable.
Then the environment of that person, there upbringing, life trauma, other psychiatric problems such as bipolar. And yet this is not absolute i.e. Some people could have these risk factors and don't get addicted. Even more interesting is why do some addicted people get better and others don't, why do some seek treatment?