The uses of attributes varies. But in general it's used in combination with reflection.
For example DisplayNameAttribute, DiscriptionAttribute, CategoryAttribute and DefaultValueAttribute are used by Visual Studio to populate the property pane when using the winforms/wpf designer.
All the aspect-oriented frameworks I know of uses attributes to indicate which aspect is to be applied to which class, method or property.
You implement your own attribute by inheriting from the class
Attribute
and use it like any other attribute.
[MyAttribute]
public class MyClass { }