I always see images with a runway and a rectangular flight path over it and ask myself why do the pilots take off, fly around the runway and get back and land, what is the purpose of doing that: take off, fly parallel to the runway and land? Am I missing something?
I think there are two parts to your question: why do traffic patterns exist, and why do people fly around them in circles?
First, a huge amount of aviation effort goes into avoiding collisions, for obvious reasons. One part of that is making everyone behave as predictably as possible, so that you know what to expect from other pilots and where to look for aircraft near you. That's why there are regulations on airspace, altitudes, speeds and all sorts of other things that affect how and where aircraft fly: if everyone is following the same rules then life is much easier. For example, if you're driving down a one-way street in your car, you can be (reasonably) confident that you won't meet someone coming the other way, and drive accordingly.
Because aircraft operate very closely together around airports, there's a higher risk of collisions and it's especially important to have very clear rules for how and where pilots take off, approach the runway and land. The traffic pattern is the aviation equivalent of road markings: it 'shows' where you should fly in order to fit in with everyone else, fly in the same direction, be visible to others, and generally be as obvious and predictable as possible.
Second, why do pilots take off, fly around the pattern and land again? Usually, because it's a great training exercise. In the process of going around the pattern you have to perform multiple important maneuvers and tasks, including:
- Taking off
- Climbing out in a controlled, precise way
- Making coordinated turns
- Managing airspeed
- Operating key aircraft systems like the landing gear, flaps, lights etc.
- Using checklists
- Working with ATC (if it's a controlled airport)
- Descending in a controlled, stable approach to land
Since taking off and landing are often considered the riskiest parts of a flight, doing pattern work is a great way to get as much practice as quickly and easily as possible. For example, I just got back from doing some night pattern work: I did 10 takeoffs and landings in about 35 minutes. That packs a lot of practice into a short amount of time, which is useful for everyone but especially for student pilots.