Maternal aggression, as you might expect, originates from a queen if provoked after she has given birth to kittens. Generally she is acting to protect her kittens. Mother cats can be quite ferocious and will not hesitate to scratch and/or bite if pushed beyond their limits. Unless you have an excellent relationship with the queen, it is best to leave her and the kittens alone.
Pain Induced aggression results from cats that are suffering from pain, usually related to a medical condition, but not always. These cats try to give signals that they do not want to be touched or handled, but the signals can be quite subtle and easily missed by those who are not familiar with feline body language. Pain can be caused by a very visible injury such as a bite wound or broken bone. However, like people, cats can suffer from unseen, many times chronic, maladies such as feline stomatitis and arthritis. Cats with hyperthyroidism sometimes exhibit aggression, although it is not related to pain. If a person does not pick up on the signals that a cat doesn't want to be petted/touched, the cat's behavior can escalate to aggression involving spitting, scratching, biting, even attack. If your cat has always been gentle and kind and suddenly is aggressive, it's best to get kitty to a veterinarian for examination and treatment.
Petting Induced aggression stems from petting a cat in an area the kitty doesn't like, possibly from being startled if petted while asleep or receiving too much petting in one area. Many cats enjoy petting to their heads and cheeks, but cannot tolerate petting down their backs, on their feet and certainly not their abdomens. Cats will bite if they continue to receive petting in such uncomfortable areas. If a cat is sleeping, even gentle petting could startle them and cause an attack to your hand. Wait till kitty is fully awake to offer attention. Like people, over stimulation by petting or rubbing can be very uncomfortable, even painful. While petting, be mindful that the cat is exhibiting relaxed postures and is truly enjoying the attention.
Redirected aggression generally occurs between pets, usually between two cats, but can also occur with to people. The usual scenario is where two animals are viewing something of interest, but something that could be threatening. They become so involved in the object they are watching, that if they look away and the other party is directly in their path or the other party moves, they perceive a threat to themselves and attack the other party. It doesn't seem fair, but it's a natural instinct for many cats to protect themselves this way. Basically the cat is deeply engaged, becomes startled and takes that energy and emotion out on another party. These cases can last only moments, but sometimes the ill will or fear of the other party that arises can last and will need to be resolved through behavior modification. In some cases, medication is required to calm the cat(s) for behavior modification to be effective.
Idiopathic aggression, as the term indicates, seems to have no clear genesis. The cat is aggressive, lashing out and fighting for no apparent reason. There is always a reason; although finding it might be a challenge. There could possibly be brain disease or a neurological reason. If no plausible reason can be determined for the aggression, it's best to have a veterinarian examine the cat. This may require blood work and x-rays for a proper diagnosis.