\documentclass{standalone}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{parskip}
\usepackage{marvosym} %Lightning symbol
\usepackage[usenames,dvipsnames]{color}
\usepackage[hidelinks]{hyperref}
\renewcommand*{\familydefault}{\sfdefault}

\usepackage{bbm} %For \mathbbm{1}
%\usepackage{bbold}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
    % Cirlce
    \draw[gray] (0,0) -- (10,0);
    \draw[dotted] (0,2) -- (10,2);
    \draw[gray] (0,2) arc (90:270:1);
    \draw[gray] (10,0) arc (-90:90:1);
    \foreach \x in {0,...,20} {
        \draw ({0.5*\x},0) circle (0.04);
    }
    \foreach \a in {-3,...,3} {
        \draw (10,1)+({\a*20}:1) circle (0.04);
        \draw (0,1)+({180+\a*20}:1) circle (0.04);
    }
    % Numbers
    \foreach \x in {0,...,20} {
        \draw ({0.5*\x},0.3) node {$\x$};
    }
    % Patch P
    \draw[red] (0.5*6,-0.5) -- (0.5*14,-0.5);
    \foreach \x in {6,...,14} {
        \draw[fill,red]  ({0.5*\x},-0.5) circle (0.05);
    }
    % S cap P
    \foreach \x in {7,8,10,11,13} {
        \draw[fill,blue] ({0.5*\x},-1.0)+(-0.05,-0.05) rectangle +(0.05,0.05);
    }
    % S \ P
    \foreach \x in {1,2,4,16,17,19} {
        \draw ({0.5*\x},-1.0) circle (0.07);
    }
    \draw (3,1) node {$P_\mathrm{min}$};
    \draw (7,1) node {$P_\mathrm{max}$};
    \draw (0.5*1,1) node {$S_\mathrm{min}$};
    \draw (0.5*19,1) node {$S_\mathrm{max}$};
    \draw[->] (3,0.8) -- +(0,-0.3);
    \draw[->] (7,0.8) -- +(0,-0.3);
    \draw[->] (0.5*1,0.8) -- +(0,-0.3);
    \draw[->] (0.5*19,0.8) -- +(0,-0.3);

    \draw (0.5*2.5,-1.5) node {$\leftarrow S_\mathrm{left} \rightarrow$};
    \draw (0.5*17.5,-1.5) node {$\leftarrow S_\mathrm{right} \rightarrow$};

    % Rectangle around legend
    \draw (10.7,-0.2) rectangle (12.3,-1.8);

    \draw[fill,red] (11,-0.5) circle (0.05);
    \draw (11.1,-0.5) node[anchor=west] {$P$};

    \draw[fill,blue] (11,-1.0)+(-0.05,-0.05) rectangle +(0.05,0.05);
    \draw (11.1,-1.0) node[anchor=west] {$S\cap P$};

    \draw (11,-1.5) circle (0.07);
    \draw (11.1,-1.5) node[anchor=west] {$S\cap\overline{P}$};
\end{tikzpicture}

\end{document}
