Rats are social animals, gaining much enjoyment and stimulation from each other's company. They live in large family groups in the wild, so in captivity they live a more natural life if kept in pairs or more. They are not like the Syrian hamster, which is a naturally solitary animal, and hence is kept alone as a pet.
Rats living in groups can have fun chasing each other around, grooming each other, sleeping in a heap, playing tug-of-war with food, wrestling, sometimes scrapping, communicating, forming friendships, and generally acting like schoolchildren at playtime. If one rat wants peace and quiet, it can simply go off and sleep alone; if it wants company, friends are always at hand. It has many more options than the single rat, who can only sleep, or sit and wait for human attention. Rats living in groups have more full and varied lives than any single rat.
Zoos and laboratories nowadays focus on 'environmental enrichment' - ways in which captive animals can be given more interesting lives by mimicking aspects of their wild relatives' lifestyles. The most important element of enrichment is allowing the animals to live in similar social groups to those found in the wild, since social animals have evolved to flourish in the company of others of their own kind. They are not 'designed' to live happily alone.