There is a definition of IwahoriHecke algebras for Coxeter groups in terms of generators and relations and there is a definition of Hecke algebras involving functions on locally compact groups. Are these two concepts somehow related? I think I read somewhere that the Hecke algebra with functions includes IwahoriHecke algebras, is that correct? Is there a good motivation for introducing and studying either type of algebras? How much is known about their representations?

A Hecke algebra describes the most reasonable way to convolve functions or measures on a homogeneous space. Suppose that you have seen the definition of convolution of functions on a vector space, or on a discrete group  the latter is just the group algebra of the group or some completion. Then how could you reasonably define convolution on a sphere? There is no rotationally invariant way to convolve a general $f$ with a general $g$. However, if $f$ is symmetric around a reference point, say the north pole, then you can define the convolution $f * g$, even if $g$ is arbitrary. This is the basic idea of the Hecke algebra. The $(n1)$sphere is the homogeneous space $SO(n)/SO(n1)$. A function $g$ on the sphere is a function on left cosets. A function $f$ on the sphere which is symmetric about a reference point is a function on double cosets. If $H \subseteq G$ is any pair of compact groups, if $f$ is any continuous function on $H\backslash G/H$, and if $g$ is any continuous function on $G/H$, then their product in the continuous group algebra is welldefined on $G/H$. The functions on double cosets make an algebra, the Hecke algebra, and the functions on left cosets are a bimodule of the Hecke algebra and the parental group $G$. It is important for the same reasons that any other kind of convolution is important. A particular case studied by The other place that the Hecke algebra arises is as an interesting deformation of the symmetric group, or rather as a deformation of its group algebra. It has a parameter $q$ and you obtain the symmetric group when $q=1$. As I said, it is also the Hecke algebra of $GL(n,q)/GL(n,q)^+$, where $B = GL(n,q)^+$ is the Borel subgroup of uppertriangular matrices (all of them, not just the unipotent ones). There is a second motivation for the Hecke algebra that I should have mentioned: It immediately gives you a representation of the braid group, and this representation reasonably quickly leads to the Jones polynomial and even the HOMFLY polynomial. When the Jones and HOMFLY were first discovered, it was simply a remark that the braid group representation was through the same Hecke algebra as the convolutional Hecke algebra for $GL(n,q)/B$ (or equivalently $SL(n,q)/B$). Even so, it's a really good question to confirm this "coincidence", as Arminius asks in the comment. Particularly because it is now a fundamental and useful relation and not a coincidence at all. As Ben explains in his blog post, the first model of the Hecke algebra is important for the categorification of the second model. The coset space of $GL(n,q)/B$ consists of flags in $\mathbb{F}_q^n$, and you can see these more easily using projective geometry. When $n=2$, there is an identity double coset 1 and another double coset $T$. A flag is just a point in $\mathbb{P}^1$, and the action of $T$ is to replace the point by the formal sum of the other $q$ points. Thus you immediately get $T^2 = (q1)T + q.$ When $n=3$, a flag is a point and a line containing it in $\mathbb{P}^2$. The two smallest double cosets other than the identity are $T_1$ and $T_2$. $T_1$ acts by moving the point in the line; $T_2$ acts by moving the line containing the point. A little geometry then gives you that $T_1T_2T_1$ and $T_2T_1T_2$ both yield one copy of the largest double coset and nothing else. Thus they are equal; this is the braid relation of the Hecke algebra. When $n \ge 3$, the Hecke algebra is given by these same local relations, which must still hold. 


A few more words to explain how (Iwahori–)Hecke algebras arise as spaces of functions. The key point in identifying the Hecke algebra with an algebra of functions on a group is the presence of a Tits system, or BNpair. You can find the proof for example in Bourbaki, Lie Groups and Algebras, Chap. IV §2, Exercises 22 to 24 if I remember correctly. (The exercises are doable.) You can also find it in the book of Davis on Coxeter groups, and probably in many other places. The Bruhat decomposition tells you that $B\backslash G/B$ is in bijection with a Coxeter group $W$ (e.g., a finite group for an algebraic group over any field, or an affine group for an algebraic group over a local field), for some suitable subgroup $B$. A BNpair is, roughly, a way to express the Bruhat decomposition, together with the behavior of double cosets. Now, consider the algebra $L(G,B)$ of functions $G$ to $\mathbb C$ which are bi$B$invariant. If $W$ is infinite, you may want to restrict yourself to "compactly" supported functions, in the case when $B$ is compact (e.g., for a group over a local field). More generally, there is a "bornology" on $G$ which makes $B$ bounded, and $L(G,B)$ is the space of functions bi$B$invariant with bounded support. Then a basis of $L(G,B)$ (as a vector space) consists in characteristic functions of double cosets, so it is obviously parametrized by elements of $w$. Then you have to calculate the convolution product of two such functions. Then the convolution product can be expressed as the cardinality of some intersection of double cosets, and this is the Bourbaki exercises. If the double coset $BsB$ has cardinality $q$ for every generator $s$ of $W$, then you will get the relations you expect. 


The Hecke algebra for a Coxeter group in the generators and relations sense specialized at a prime p is the Hecke algebra in the functions sense for the corresponding split algebraic group over a finite field with p elements with respect to its Borel. I wrote a blog post about this you might want to read. 


The motivation for studying IwahoriHecke algebras (the convolution type) is the study of the unramified principal series representations. The details can get lengthy, but it is all in a paper of Borel's (Armand Borel. Admissible representations of a semisimple group over a local ﬁeld with vectors ﬁxed under an Iwahori subgroup. Invent. Math., 35:233–259, 1976.) The relationship between the convolution algebra and the algebra using Coxeter groups was due to Iwahori and Matsumoto (N. Iwahori and H. Matsumoto. On some Bruhat decomposition and the structure of the Hecke rings of padic Chevalley groups. Inst. Hautes Etudes Sci. Publ. Math., (25):5–48, 1965.) 


If you have an arbitrary (i.e. possibly nonsplit) reductive group $G$ and an Iwahori $I$ and you want to write the functiontheoretic Hecke algebra $\mathcal{H}(G;I)$ as one of these other combinatorial Hecke algebras, you should do the following: take $W$ to be the abstract extended affine Weyl group, take $S$ to be a base of the affine Weyl group $W_{aff} \subset W$ and form the combinatorial Hecke algebra in the usual way (e.g. chapter 7 in Humphreys's little grey book), except that when you are choosing the parameters $a_s$ and $b_s$ for the relations, you should replace $q$ with the index $[IsI:I]$. I believe this nonsplit situation was done by Macdonald, but I'm not sure. Edit  I realized that "usual way" above requires some clarification: First, you write $W$ as the internal semidirect product $W_{aff} \rtimes \Omega$ where $\Omega$ is the subset of elements stabilizing the base alcove. The length function $\ell$ extends from $W_{aff}$ to $W$ by simply taking the length of the projections of elements in $W_{aff}$ (so now there are nonzero but zero length elements). The Bruhat order also extends but that's not necessary now. Then the "usual way" means:


