Q:

How to write sign "|" (or) in LaTeX? 

I've tried to write \textit{P(E\ell H)} or \textit{P(E\| H)} to write | sign .  But it didn't work. 

A:

If you're trying to typeset "the conditional probability of event E given event H", you should write it -- in math mode -- as
P(E \mid H)

or, better yet,
\Pr(E \mid H)

The macro \Pr is a "math operator" and its output (the letter pair "Pr") is typeset using upright Latin letters.  The macro \mid inserts a vertical bar and surrounds it with whitespace, as is appropriate for a relational operator symbol. 
In TeX and LaTeX, there is an absolutely fundamental distinction between text mode and math mode.  Do familiarize yourself with the basics of LaTeX coding.  A good starting point is the document A (Not So) Short Introduction to LaTeX, which is available in about two dozen languages. 
A full MWE (minimum working example):

\documentclass{article}
\begin{document}
$P(E \mid H)$ or, better yet, $\Pr(E \mid H)$.
\end{document} 

A:

You can use either | or \mid.  Using \mid is better as this adds the appropriate amount of spacing around the operator. 
More importantly, you should enclose all of these in $...$ to put them in math-mode.  You will get an error if you use \ell or mid outside of math-mode. 
Compare:

The full code:
\documentclass{article}
\usepackage{}
\begin{document}

text: P(E$\ell$ H) or P(E|H) or P(E$\mid$ H)

math-mode: $P(E\ell H)$ or $P(E|H)$ or $P(E\mid H)$

\end{document}

