Given
$$Z \sim \text{Exp}(1)\qquad,\qquad Y = \begin{cases} 1, & \mbox{if } 1\leq Z\leq2 \\ 0, & \mbox{else} \end{cases}$$
I want to calculate $E(Z\mid Y)$ and $E(Y\mid Z)$.
Since $Y$ is a discrete random variable, I figured that
$$E(Z\mid Y)=E(Z\mid Y=1)1_{\{Y=1\}}+E(Z\mid Y=0)1_{\{Y=0\}}$$
which is equal to $$E(Z\mid Y=1)1_{\{1\leq Z \leq 2\}}+E(Z\mid Y=0)(1-1_{\{1\leq Z \leq 2\}})$$
But I am not sure how to continue.
Also, given $E(Z\mid Y)$ could I apply something like Bayes rule but for conditional expectation to get $E(Y\mid Z)$?
The conditional expectation $\mathbb{E}[X\vert \mathcal{G}] $ is defined as the unique (almost surely) random variable $W$ measurable with respect to $\mathcal{G}$ such that:
$\mathbb{E} \Big[ \mathbb{E}[X\vert \mathcal{G}]\cdot1_A \Big]= \mathbb{E}[X\cdot 1_A]$ for all $A\in \mathcal{G}$.
As a consequence if $X$ is $\mathcal{G}$-measurable, then $\mathbb{E}[X\vert \mathcal{G}]=X$. Hence $\mathbb{E}[Y\vert Z]=Y$ , since $Y$ is $\sigma(Z)$-measurable.
On the other hand $\sigma{(Y)}= \Big\{ \emptyset, \Omega, \{ 1\leq Z\leq 2 \}, \{ 1\leq Z\leq 2 \}^c \Big\}$, and therefore:
$\mathbb{E}[Z\vert Y]=a\cdot 1_{ \{ 1\leq Z\leq 2 \} }+ b\cdot 1_{ \{ 1\leq Z\leq 2 \}^c }$ as you wrote. Checking the definition, you will see that:
$a=\mathbb{E}[Z\cdot 1_{ \{ 1\leq Z\leq 2 \} }]=\mathbb{E}[Z| 1 \leq Z\leq 2]$ and $b=\mathbb{E}[Z\cdot 1_{ \{ 1\leq Z\leq 2 \}^c }]=\mathbb{E}[z]-a$.
Then by the definition of $Exp(1)$, you can tell that:
$a=\int_1^2 xf_Z(x)dx=\int_1^2 xe^{-x}dx$