Dwarves have relationships amongst each other. Relationships are usually formed by spending time with another dwarf. Often, the strongest relationship are between dwarves from the same migrant wave, despite time spent with dwarves from other waves. Relationships are important because their presence or absence has an important effect on the dwarf in question. Note that when it comes to familial relationships, the dwarves in question do not have to be in your fortress.
Making and talking to friends gives happy thoughts while the death of a pet, friend, parent, child or spouse gives unhappy ones. A network of friends and families are happier than individual dwarves, but are more likely to throw parties and make children, and will be much harder-hit when a familiar dwarf dies in an ambush or whatnot. Getting haunted by a familiar dwarf produces a strong negative thought as well.
Spouse - Married dwarves are spouses of one another, and will share a bed. Heterosexual couples will produce children (the happier the couple, the more children). Dwarves only ever marry once.
Lover - Lovers are basically dwarven pairs, unmarried but getting there. Like spouses, dwarves will only ever have one lover, and do not switch lovers even if their lover dies. Dwarves who are lovers and orientation-compatible and that spend enough time chatting may marry, at which point they will switch over to one bed for two and start producing children if belonging to opposite genders.
Child - Any children that the dwarf parents are the object of their attention. Babies are absolutely useless in fortresses (and a burden if the dwarf in question is a good candidate for the draft), and children do little besides throw parties and distract their parents, but their death causes a very strong bad thought. Note that adult children are still children in the eyes of their parents, and that children do not necessarily appear in your fortress.
Parents, Grandparents, Siblings - Like children, they do not necessarily have to be in the fortress.
Deity - Dwarven gods are the most important non-familial relationships for a dwarf. Dwarves can have different levels of worship ("ardent", "faithful", "casual", and "dubious"). Note that cursed creatures are always dubious worshipers of their deities, making this relationship an important sign of a vampire. Some dwarves don't worship any deities. Worshiping at a temple reduces stress by a large amount, and not being able to worship causes further stress to develop.
Object of Worship - Dwarves tend to worship megabeasts that have attacked a settlement, most likely out of fear. This relationship does not seem to change the behavior of the dwarf and the megabeast if the worshipper meets the worshipped.
Friend - Dwarves that idle near other dwarves and/or have high social skills tend to develop friends. Making a friend takes some effort on the part of the dwarf, and happens most often within individual waves. Personalities play a part as well. Making friends causes a happy thought, and the death of friends causes unhappy ones. Lovers develop from a dwarf's pool of friends.
Grudge - Are the opposite of friendships, and tend to develop between dwarves of conflicting personality traits. Sometimes it is possible to have your starting dwarves form grudges even before they arrive at the new fortress location. Making a grudge causes an unhappy thought, but ironically, the death of a grudgee actually causes a bad thought as well.
Long-term Acquaintance - Long-term acquaintances are dwarves that are familiar with one another, but not yet friends. The death of an acquaintance does not produce a fun thought however the loss's occurrence. At embark, the seven starting dwarves will each be long-term acquaintances or friends with each other.
Passing Acquaintance - Passing acquaintances are dwarves that are familiar with one another, but just barely. As long term acquaintances do not produce a bad thought, passing ones do not either. If an acquaintance does not make contact with the dwarf over a time, they will be forgotten, absent from the relationships screen.
Over time, dwarves who spend time idling near each other will begin to form friendships and grudges. This happens through 'chats'.
Two dwarves who are standing on the same tile, or adjacent tiles, may decide to chat if they are idle. Dwarves who are busy eating, drinking, or doing any job, will not chat with one another. This has the interesting amusingly realistic effect that two dwarves who work side by side for years may barely know each other, or even not at all.
As two dwarves accumulate these chats, they will form opinions of each other, based on a 'compatibility' score. Dwarves who like similar things (such as elephants), have the same skills (such as two miners), or who have similar personalities will form friendships. These begin as passing acquaintances, who will then become long-term acquaintances (if the two aren't too compatible, but not too incompatible) or friends (if the two dwarves are compatible enough). Dwarves who are too incompatible may instead form grudges. Dwarves who don't chat enough may lose acquaintances over time.
Dwarves who are compatible enough, and who chat enough, can become lovers. In order to be eligible for this, a dwarf has to be an adult, not have a age difference higher than ten years, be orientation-compatible, not be too closely related to their new friend, and have no other spouse or lover (even dead). Lovers who continue to have enough opportunities to chat and are willing to commit will eventually get married.
Dwarves with high social skills make friends (and grudges) quicker than unskilled dwarves.
It is possible for two dwarves to have different opinions about each other. For example Urist can treat Bomrek as a long-term acquainted buddy while Bomrek counts Urist as a barely recognised person.