There are 2 common approaches to backing up the Pi.
The most common uses
dd or a program e.g win32diskimager to make an exact copy of the SD card. These copy the
MBR (which is not used by the pi for booting) plus all partitions, including any unused space.
This produces large images (which can be compressed) and has the risk of being too large to restore, although this is not common. I use this approach and have had no problems restoring to different SD cards. There are ways of working around this, but this is complicated, and requires an understanding of Linux and disk structure.
NOTE the size of the image is unaffected by raspi-config's file expansion feature.
The other common approach is to copy files to another device. My implementation of this is described in https://raspberrypi.stackexchange.com/a/28087/8697
There is a third approach, which is to make copies of individual partitions, then restoring these. This is complex, not least because the way partitions are allocated on the Pi differs from the normal default used by most partitioning software (this is done for efficient utilisation of the blocks on the SD card, so partitions are contained within a number of blocks with no overlap).
You will find literally hundreds, if not thousands of posts on each of these, unfortunately not all are technically correct.