You can use \boxed
command from amsmath
package
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation*}
X=\boxed{X_1 X_2}\quad \boxed{X_3 X_4}\cdots\boxed{X_5 X_6}
\end{equation*}
\end{document}

To add colors and labels below boxes
\documentclass{article}
\usepackage{amsmath,tcolorbox}
\tcbuselibrary{theorems,skins}
\usetikzlibrary{arrows.meta}
\newlength\mylabelshift
\setlength\mylabelshift{3mm} % to be adjusted if needed
\newcommand{\drawlabel}[1]{\draw[Stealth-Stealth]([yshift=-\mylabelshift]frame.south west)--node[fill=white]{\(#1\)}([yshift=-\mylabelshift]frame.south east);}
\newtcbox{\mymathbox}[1][l]{
enhanced,
nobeforeafter,
math upper,
tcbox raise base,
colback=blue!30, % to set background color
size=small,
geometry nodes,
overlay={\drawlabel{#1}},
tcbox width=minimum center,
width= 2 cm ,% to be adjusted if needed
}
\begin{document}
\begin{equation*}
X=\mymathbox{X_1 X_2}\quad \mymathbox{X_3 X_4 X_5}\cdots\mymathbox{X_5 X_6}
\end{equation*}
\vspace{1cm}
\begin{equation*}
X=\mymathbox[a]{X_1 X_2}\quad \mymathbox[b]{X_3 X_4}\cdots\mymathbox[c]{X_5 X_6}
\end{equation*}
\end{document}

tick
mark below the voting mark.