There is no single convention. Modern probability texts favour \mathbb{E}; statistics texts often use an upright E via \operatorname. The bracket style varies too: E[X], E(X) and E X all appear. Pick one and keep it.
All ways to write it
\mathbb{E}[X]blackboard EPackage: amssymb\operatorname{E}[X]upright ENo package neededE[X]plain italic E, common in older textsNo package needed\mathrm{Var}(X)varianceNo package needed\operatorname{Cov}(X, Y)covarianceNo package needed\mathbb{P}(A)probability, same styleNo package needed
Commands marked with a package need that \usepackage line in a LaTeX document.
Example
\mathbb{E}[X] = \sum_{x} x \, P(X = x), \qquad \operatorname{Var}(X) = \mathbb{E}[X^2] - \mathbb{E}[X]^2Expectation of a discrete variable and the variance identity.
Questions
How do I get a bold or upright E without amssymb?
\operatorname{E} gives an upright roman E in any setup, including KaTeX.
Using expectation in Confluence
Confluence Cloud has no built-in LaTeX. With LaTeX Math for Confluence you add a math macro to any page, type \mathbb{E}[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.