It is mostly standardized procedures.
I take as example Amsterdam airport (AMS), but the following is applicable to most, if not all, major commercial airports.
Let's look at the departure charts, in particular this one:
as you can see, if an airplane is departing via that runway, it MUST follow one of the two specified paths to exit the airspace of the airport through the "ANDIK" waypoint. It has different paths for the other exit waypoints, but they are similarly defined and limited in number.
In the link you will find similar charts for each of the runways.
Within restrictions due to factors like terrain, noise abatement over populated areas (as Dan's mentions in his answer), areas restricted due to security and safety (over city centres, government and military installations, nuclear power plants and such) or used for other purposes (military operations, space launch and such), these routes are defined so they don't intersect (much).
This ensures arriving and departing aircraft don't come close to each other, which greatly reduces the risk of collision and allows responsibility for different routes to be split among several controllers who can each handle their assigned routes mostly independently of the others.
Weather conditions and other factors will dictate which runways are used, but the runway will dictate how the airplane will exit the airport's airspace, after the appropriate exit waypoint has been selected (you generally would not use a waypoint on the north side if you have to go south).
So, to summarize:
- you have a limited amount of exit waypoints
- you have a limited amount of runways
- weather will restrict your choice (well, the airport's tower will do this for you) of runway
- your destination will restrict your choice of exit waypoint
- for each runway-waypoint pair you will have one or two possible routes
This results in the kind of behaviour you have observed.