Well first thing would be the lens mount.
It's a nikon camera so the lens mount bayonet is nikon F. So it takes lenses with a bayonet and electrical contacts designed to fit that particular shape. Other manufacturers use different shaped bayonets.
Also, your D3100 doesn't have a built in focus motor, so some lenses that don't have an internal focus motor won't auto focus on your D3100 (and example of this is the 50mm f/1.8D). But there aren't many lenses like this, most are AF-S now and so will work fine on the D3100.