How can I draw a Karnaugh map

I highly recommend kvmacros. It isn't your average package which you can simply use with \usepackage{}, instead you have to manually install it, but this should not be a problem.

It is not the most intuitive, but if you play with it a little, you'll get the idea. So, here how the code could look:

\documentclass{article}
\input{kvmacros}

\begin{document}
\karnaughmap{5}{}%
{{$x_1$}{$x_4$}{$x_2$}{$x_5$}{$x_3$}}%
{%
0011011001101000%
0110011011001000%
}%
{%
%Single Ones
\put(2.5,3.5){\oval(0.9,0.9)[]}
\put(1.5,0.5){\oval(0.9,0.9)[]}
\put(7.5,2.5){\oval(0.9,0.9)[]}
\put(0.5,1.5){\oval(0.9,0.9)[]}
%Pairs of Ones
\put(1,2.5){\oval(1.9,0.9)[]}
\put(4,2.5){\oval(1.9,0.9)[]}
\put(6,3.5){\oval(1.9,0.9)[]}
\put(7,0.5){\oval(1.9,0.9)[]}
\put(4,0.5){\oval(1.9,0.9)[]}
}
\end{document}

And most importantly the result:

KV Map

I am assuming every not 1 is 0 (else simply use ~). If you don't need the number in each square, you could just put \kvnoindex in front, for other options just consult the documentation.

EDIT: This might be more than was asked, but here is another example, with a more fancy result.

\documentclass{article}
\usepackage[dvipsnames]{xcolor}
\input{kvmacros}

\begin{document}
\karnaughmap{5}{$f(x_i)$}%
{{$x_1$}{$x_2$}{$x_3$}{$x_4$}{$x_5$}}%
{%
0011011001100110%
0110011001000110%
}%
{%
%Single Ones
\textcolor{Blue}{
\put(2.5,3.5){\oval(0.9,0.9)[]}
\put(7.5,2.5){\oval(0.9,0.9)[]}
\put(0.5,1.5){\oval(0.9,0.9)[]}}
%Pairs of Ones
\put(1,2.5){\oval(1.9,0.9)[]}
%Quadruples of Ones
\textcolor{Yellow}{
\put(4,2){\oval(1.9,1.9)[]}}%
\textcolor{Green}{
\put(6,4){\oval(1.9,1.9)[b]}
\put(6,0){\oval(1.9,1.9)[t]}}%
\textcolor{Red}{
\put(5,0.5){\oval(3.9,0.9)[r]}
\put(3,0.5){\oval(3.9,0.9)[l]}}
}
\end{document}

Here the result:

Output

Have Fun!