In The Sims, windows would allow a room to be lit during daylight hours, which would improve its room score. Starting with The Sims 2, windows provided more realistic lighting, with light being brighter near windows, and inside lighting shining out through them at night.
In The Sims 2, Sims may spontaneously look out of a window, and with Seasons, they may look out of a window to react to the weather. Occasionally, very neat Sims may spontaneously clean a window. Sims cannot be instructed by the player to do any of these things without the use of mods or cheats.
In The Sims 3, Sims can look into windows if the player clicks the window and selects "Look Through Window". When a Sim is looking through a neighbor's windows, there is a chance that someone inside will catch the peeping Sim and shoo him or her home. This will also cause a drop in the two Sims' relationship. When looking through a neighbor's windows, the inside of the house can be seen as if the Sim was inside. Sims with the insane and neurotic traits may autonomously look through a window, but this has no effect. It simply shows that the Sim has one of those traits.
In The Sims 4, windows do not grant any form of gameplay and only serve as decoration. However, some apartments in San Myshuno have the Great View lot trait, which makes Sims receive an energized "Fantastic View" moodlet when within range of an exterior-facing window.