An antigen can be any substance that may act as a target for recognition by a specific antibody. Most antigens are protein or modified proteins (e.g. by the addition of carbohydrate or lipid groups), but most biological molecules of sufficient size can act as antigens.
Smaller molecules may not elicit an immune response in isolation, but can abnormally alter native proteins, rendering them antigenic. In these situations, these smaller molecules are called haptens. Even non-biological materials can act as antigens, a reflection of the versatility of the immune system.
A single protein may have several epitopes, which can be regarded as the specific 3-dimensional molecular configuration that the antibody recognises and binds to.
The immune system is sophisticated enough to be able to recognise 'self' and is to be prevent antibodies against 'self' proteins. However, immune dysregulation can lead to pathology as seen in auto-immune disorders. Also, certain bacterial antigens may mimic certain human proteins, and an immune response to the bacteria can lead to inadvertent damage to 'self' proteins (this is thought to be the cause of damage in Rheumatic fever).