I have never understood how a balun or a unun works and under which situation I need to use either of them in an antenna feed line.
A balun matches a balanced load to an unbalanced line, but it can also do other useful things. A current balun can present a high impedance to common-mode signals, which will help reject noise. Common mode signals are the same on both conductors, so are not "balanced" or differential.
An unun is an impedance transformer, usually
9:1, which matches an unbalanced antenna to a feedline. A
9:1 transformer is often used for an end-fed half wave antenna.
This document by Jim Brown (K9YC) is long, but tremendously helpful in understanding baluns, chokes, and reducing RF noise: