How does item level and rarity affect the possible attributes?

Solution 1:

The requirement level is defined by the item and every item has an internal level number.

Affix Level Minimum

In Diablo 3 every item has an internal level number, and every affix has an "affix level minimum". If an item's internal level number is below an affix's level minimum, the affix cannot be applied to the item. This prevents the incongruity of attaching extremely powerful affixes to crude, lowly items.

Source: Diablo 3 Signature Series Guide

There is no list with items and their internal level numbers so I guess they are assigned randomly for every item.

But at least legendary items also have a total affix count and bonus affixes. Here is an example:

Blackguard: LVL REQ: 48; TOTOAL AFFIX COUNT 6; BONUS AFFIXES: 2; GUARANTEED AFFIXES: Damage Bunus, Min/Max Damage, Strength/Dexterity, Crowd Control, Reduction