Basic perks on uncommon and rare items are unlocked by killing your enemies.
Perks on epic and legendary items are unlocked by collecting fame. The fame you earn is equally divided between items that have currently equipped on your character. On each item, you can unlock one perk at a time.