You can easily check the reasons for gaining reputation on the reputation tab in your profilethe reputation tab in your profile. In a more concise format, overview of reputation changes can be seen here: http://math.stackexchange.com/reputationhttps://math.stackexchange.com/reputation
For some links leading to more detailed information about reputation, you can have a look here.
To answer also the additional question you asked in your comment: "Couldn't you abuse the system by just spamming accept answers?"
It is true that for each accepted answer you gain 2 reputation points. But if you were posting low quality question just for the purpose of gaining reputation, your questions would be very likely downvoted and you would be losing reputation. If you are asking interesting well-thought question, then your behavior is useful for the site, so I would not call it "abuse of the system". Moreover, you cannot gain a lot of reputation too quickly in this way. You can ask at most 6 questions per day, at most 50 questions per month.