What always works in such cases is to add a simple tabular.
\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{datavisualization}
\usetikzlibrary{datavisualization.formats.functions}
\begin{document}
\begin{tikzpicture}
\datavisualization[scientific axes=clean]
[
visualize as smooth line=Gaussian,
Gaussian={pin in data={text={$e^{-x^2}$},when=x is 1}}
]
data [format=function] {
var x : interval [-7:7] samples 51;
func y = exp(-\value x*\value x);
}
[
visualize as scatter,
legend={south east outside},
scatter={
style={mark=*,mark size=1.4pt,text width=1.5cm,cells={align=left}},
label in legend={text={\begin{tabular}[t]{l}
$\sum\limits_{i=1}^{10} x_i$, where \\
$x_i \sim U(-1,1)$
\end{tabular}}}}
]
data [format=function] {
var i : interval [0:1] samples 20;
func y = 0;
func x = (rand + rand + rand + rand + rand +
rand + rand + rand + rand + rand);
};
\end{tikzpicture}
\end{document}

If you have more of those, you may want to change the node styles.
\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{datavisualization}
\usetikzlibrary{datavisualization.formats.functions}
\begin{document}
\begin{tikzpicture}[cells={nodes={align=left}}]
\datavisualization[scientific axes=clean]
[
visualize as smooth line=Gaussian,
Gaussian={pin in data={text={$e^{-x^2}$},when=x is 1}}
]
data [format=function] {
var x : interval [-7:7] samples 51;
func y = exp(-\value x*\value x);
}
[
visualize as scatter,
legend={south east outside},
scatter={
style={mark=*,mark size=1.4pt,text width=1.5cm,cells={align=left}},
label in legend={text={$\sum\limits_{i=1}^{10} x_i$, where \\
$x_i \sim U(-1,1)$}}}
]
data [format=function] {
var i : interval [0:1] samples 20;
func y = 0;
func x = (rand + rand + rand + rand + rand +
rand + rand + rand + rand + rand);
};
\end{tikzpicture}
\end{document}
In any case, it would be great if you could in the future provide complete documents that start with \documentclass
, end with \end{document}
and contain just enough packages and libraries to be compiled. This makes it easier to look at your question(s).