\bar is for the sample mean (x̄), the complex conjugate and set complements. \overline stretches to cover an expression and is also used for closure and repeating decimals.
All ways to write it
\bar{x}short bar over one letterNo package needed\overline{xyz}bar over a groupNo package needed\underline{x}bar beneathNo package needed\bar{z}complex conjugateNo package needed
Example
\bar{x} = \frac{1}{n}\sum_{i=1}^{n} x_i, \qquad \overline{A \cup B} = \bar{A} \cap \bar{B}A sample mean, and De Morgan's law with overlines.
Questions
\bar or \overline for the mean?
\bar{x}: it is the right size for one letter. \overline is taller and meant for longer expressions.
Using bar in Confluence
Confluence Cloud has no built-in LaTeX. With LaTeX Math for Confluence you add a math macro to any page, type \bar{x} and it renders inline or as a block, with a live preview while you edit. Every command on this page renders there without extra packages.