The key point is that no matter what polarity the voltage on the bridge inputs, the polarity of the outputs remains the same.
For example, when the top alternating current (AC) input is positive, current flows like so:
When the botton AC input is positive, current flows like so:
Either way, the top direct current (DC) output remains the positive terminal.
The bridge rectifier may be constructed from discrete components (i.e. 4 separate diodes ), but it is also available from many suppliers as a single component.
It is frequently used to convert AC current into DC current with the addition of a capacitor:
The capacitor serves to smooth the output from the bridge rectifier.