First and foremost, the recommended and easiest way to power your Raspberry Pi is through the Micro-USB or USB-C port on the side of the Raspberry Pi.
A spare phone charger is all you need for a stand-alone Raspberry Pi being run in 'headless' mode. Or a purpose-bought high current phone charger if you want to start plugging things into the USB sockets.
My personal experience is that the Micro-USB socket is an unreliable connector for delivering electricity to anything, be it a Raspberry Pi, a tablet or a telephone, and if I'm installing a Pi anywhere than on my desk, soldering a couple of wires on to supply the power is preferable to a never ending string of 'site visits' to wiggle the plug.
The preceding text is for the Raspberry Pi models prior to the Pi3B+ which requires its own portable nuclear power station to supply enough power to keep it running stably, but in my experience that is still not a guarantee.
This article is more for when you are using several Raspberry Pi together, say in a cluster where you don't want to use all your available wall outlets for a separate power supply / phone charger for each Raspberry Pi in your cluster, or you could use a 5 volt power supply with enough capacity to run all of your Raspberry Pi, and then run an individual cable, terminated with a Micro-USB or USB-C plug to each of them, this is one option, but it makes each Raspberry Pi require its own width and then another 25mm to 30mm for the Micro-USB or USB-C plug, making an enclosure that will hold six Raspberry Pi side by side, only hold four because of the Micro-USB or USB-C plug sticking out the side.
You can power your Raspberry Pi using two pins on the GPIO header. (** Warning ** This is not something you just do, you must have some clue, it is really easy to cause irrepairable damage to your Raspberry Pi if you make even the smallest of mistakes.) (That was a warning to the clueless, I will not be held responsible for you burning the house down or buggering up your Raspberry Pi).
Continuing now for the folks with clue. While this may seem the way to go to maintain a small footprint, it has at least two downsides to consider. Firstly, if you power your Raspberry Pi through the GPIO, the two wires will prevent you from using most of the many HATs that are available for the Raspberry Pi. And secondly, power applied to the GPIO in this way, bypasses the fuse and other electronic safeguards on the Raspberry Pi circuit board.
Bear in mind that the length of the wires used is important, more so in the later model Raspberry Pi. Thin wires in the power lead means less copper used in manufacturing and more profit for the Chinese manufacturer. Use of too thin wire can make a perfectly acceptable power supply next to useless. The thinner the wire, the higher its resistance, leading to loss of voltage and the production of heat. In tabloid terms, your Raspberry Pi might crash and the house may burn down! But it's Ok, we'll just take a page from the government's play book, and blame it on Mr. Putin.
The third option is to solder two wires to the underside of the board, below the Micro-USB or USB-C socket. This requires that you, (or your mum), can actually solder and have the necessary soldering iron and steadiness of hand to attach the wires without causing any short circuits or other damage in the attempt. The red wire or +5v goes to the solder pad marked PP2 on the silk screening, on the Pi2B this is adjacent to PP1 and they are to all intents and purposes the same thing. On the Pi3B PP1 has absconded during the upgrade process so you have to use PP2. The black wire or 0v is connected to the solder pad marked PP5, but you can also use PP3, PP4 or PP6, which according to the schematics, are all the same thing from an electrical viewpoint. (The references to 'red' and 'black' are by convention only, the electricity doesn't give two hoots what colour the wire is. I've actually seen working projects where every wire is yellow, regardless of its function in the project, and the electricity didn't care about that either.)
The choice of wire gauge that I used was dictated by what I had in the shed, but if you are buying wire to do this, make sure it is thick enough to carry the expected current without melting the insulation, and thin enough so that you can safely solder it to the small solder pads on the Raspberry Pi PCB without causing short circuits or other damage. If the power supply is not immediately adjacent to the Raspberry Pi, thin wire can always be terminated locally and the longer run to the power supply unit being made in a thicker wire to prevent causing an overly large voltage drop on the supply.
TL;DR - Conclusion.
So to recap, the Micro-USB or USB-C socket on the side of the Raspberry Pi is probably the safest way to power it. Unless you have a good reason not to use the Micro-USB or USB-C socket, (space saving footprint for when you are using multiple Raspberry Pi in a single enclosure is my excuse, although I have several Pi that exhibit an intermittently high resistance in the Micro-USB socket/plug. This causes the Pi to start filling the kernel.log with, Under-voltage detected! (0x00050005) and a moment later, Voltage normalised (0x00000000), even though it has been running fine for the last three months. The cure is to gently wiggle the Micro-USB plug. This will either crash the Pi or restore the power connection for another few weeks). The soldering on of wires is probably safer than using the GPIO powering method because of the bypassed fuse etc.
Additional Important Information - The Raspberry Pi requires no more than 5.25 volts of DC. You can't run it off a car battery charger or the transformer from your train set. Neither can you connect it to the mains via a suitable resistor.
5 volts of direct current only, anything else will break your Raspberry Pi and/or kill you.
The final image shows the position of the wires within the USB plug, should you wish to produce your own power lead with an adequate wire gauge for the job. The plugs are readily available on AliExpress or eBay in case you do not have a local stockist close at hand. Be particularly careful wiring the USB-C plugs used in the Raspberry Pi 4. The plugs may be reversible, but the wiring positions on the pcb in the 'DIY' USB-C plugs are not.