In The Sims, a roof would automatically be generated when an area enclosed by walls was open at the top. Players could select a roof pitch and roof texture, which would be applied to all buildings on the lot. Roofs in The Sims are mostly aesthetic, since there is no weather in the game.
The Sims 2Edit
In The Sims 2, there are several types of roof to choose from. The base game has hip, gable, 3-Hip and Half-Hip roofs, and flat roofs. Other expansions add domes, cones, octagons, pagoda-style roofs, and mansard roofs. All of these, except for the mansard roof, are available in the Roof section of Build mode. Mansard roofs are made by using pieces found in the Architecture section. Flat roofs use flooring.
Roof pitch for non-flat or mansard roofs is set at 45 degrees, but can be adjusted to between 15 and 75 degrees using the roofslopeangle cheat (if The Sims 2: Nightlife or a later expansion is installed). With Mansion and Garden Stuff, roof angles can be changed individually without the use of cheats.
Roofs are particularly important in The Sims 2: Seasons, as they keep the elements out.
The Sims 3Edit
The Sims 3 re-introduces auto-roofing, though it can be disabled. The roof tool in The Sims 3 mostly expands on the roofing options from The Sims 2, and allows the adjustment of roof pitch without the use of a cheat, a feature previously available in The Sims; The Sims 3: Ambitions (as well as an update for the base game)  allow the adjustment of pitch of individual roof segments. The Sims 3: World Adventures allows a roof type with pagoda-style eaves. Roofs, like in The Sims 2: Seasons, is essential to keep the out the elements from the weather in The Sims 3: Seasons.
The Sims 4Edit
The Sims 4 revamps the roof system completely. Auto-roofing has been removed, and instead roofs can now be pushed and pulled to the size and shape the player wants it to be. The base game has gabled, half gable, hipped, and half hipped roof styles, along with their diagonal versions. With the push and pull mechanic, roofs can also be shaped into different styles such as domed, pagoda, awning, and gambrel. As of now, The Sims 4 does not have any round roofs however, it has been confirmed that The Sims 4: Cats & Dogs or a future patch will introduce octagonal and round roofs.
So far, there are no weather or seasons in The Sims 4, making roofs mostly aesthetic.