Dogs operate very honestly and clearly. They show their emotions and needs through body language. Whether they are trying to show aggression or appeasement behaviours, you'll see changes to posture and expression. Identifying aggression in dogs is fairly straight forward with a little bit of learning.
Signs of dog aggression all come at certain thresholds. A dog will show signs of aggression in escalating patterns in order to convey their intent. All of these signs will exist at different thresholds. When a dog is said to be sub-threshold, they are willing to encounter and accept the current situation without showing signs of aggression or agitation. When you spend time socializing and building desirable behaviours for things that don't have a naturally conditioned positive response, like nail trimming or grooming, you are actually building your dog's threshold.
If a dog is put off, they may initially show subtle signs of aggression. They may pin their ears, lightly curl their lip, offer a low growl, etc. These are all warnings. If their warnings work, they will continue to operate at that threshold in a recurrent situation. If the warning doesn't work, they will up their behaviour to the next level, which may include a snarl, snap or bite. We can build these thresholds with the right information and the right approach by adding more tolerance to the dog's ladder of thresholds and reinforcing each step. Your approach will most certainly differ depending on the reason for the dogs aggression.
In initial simplification, aggression can be divided into two main types: offensive and defensive. Identifying the dog's intent will help you address the unwanted behaviour and build your dog's thresholds.
Offensive aggression occurs when a dog is feeling the need to be assertive in a situation. Perhaps they are facing another dog or guarding an object. You'll see motion forwards and differences in their body postures. Some differences are subtle and others are obvious. A dog who's feeling assertive will likely have their ears motioning forward, they may have hackles and tail raised to make them appear larger. Their chest will be forward and their eyes will be locked onto what they are trying to intimidate.
Offensive aggression is quite rare in dogs when dealing with humans. Most often, if a dog is behaving aggressively, it is either a conditioned response or a defensive response. Unfortunately, dogs are often misdiagnosed as being overtly or offensively aggressive when they are regarded by individuals that lack the proper training. It's a normal human response to assume the dog is being overt or "mean," when they are actually worried and responding defensively.
It is quite possible to create an conditioned offensive response in a dog by inadvertently rewarding it. For example, if a dog is protecting a bone from a human because they are worried it will be taken away, they may growl. If that works (I.e. the human leaves them alone), they will learn that this sort of behaviour is rewarded (I.e. they got to keep their bone). If this situation is presented again, they rely on their history of growling to get their way and are empowered if it works again. If it doesn't work they may try snarling the next time. This creates an offensive response through conditioning and builds the wrong behaviour.
A dog who is behaving defensively will display different body language. They'll likely try to shrink away. You'll see them tuck their tail to protect their genitals and belly, avert their gaze and make attempt to flee the situation. If this dog is not allowed to flee the situation, they'll be forced to fight. Most likely, this is their last resort.
Defensive aggression is the more common type of aggression seen in dogs. Most dogs are happy to go along to get along. It's only when they are threatened that they'll resort to aggressive body postures and language to try to convey their concern.
Seeing aggression at it's earliest warning is not always easy. Often, dogs show sub-threshold warnings that are very slight and may be easily missed. Things like slight differences in their ear carriage, averting their eyes, slight lip licks, etc. Educating yourself in the cues your dog may offer will help you help them and will help to keep everyone safe.