Clarification on operators and completeness relation Given the momentum operator $$\hat{p} = -i\hbar \partial_x$$ we can apply the completeness relation to get $$\hat{p} = (-i\hbar \partial_x)(\sum_{a'}\vert a' \rangle \langle a' \vert) = -i\hbar(\sum_{a'}\vert a' \rangle \partial_x \langle a' \vert)$$
My question is why we can say this is equal to $$-i\hbar(\sum_{a'}\vert a' \rangle (\partial_x \langle a' \vert))$$ as opposed to $$-i\hbar(\sum_{a'}\vert a' \rangle (\partial_x) \langle a' \vert)$$ where $\partial_x$ is not acting on anything. The counterexample to this that I'm envisioning is this:
$$\hat{p} = -i\hbar \partial_x(\frac{x}{x}) \neq 
-i\hbar \frac{1}{x} \partial_x(x) $$ In this case, we are "inserting 1" but $\frac{x}{x}$, but we cannot put the operator in the middle of these and allow it to act on one of the terms in the "inserted 1" ($\frac{x}{x}$). Where is my counter-example going wrong, and why can we insert the operator into the completeness relation and let it act on one of those states?
EDIT / ADD ON:
The motivation for this is understanding the following line in Sakurai (2.1.3 Energy Eigenkets):
$$e^{\frac{-iHt}{\hbar}}=\sum_{a'}\sum_{a''}\vert a'' \rangle \langle a''\vert e^{\frac{-iHt}{\hbar}} \vert a' \rangle \langle a' \vert = \sum_{a'} \vert a' \rangle e^{\frac{-iE_{a'}t}{\hbar}} \langle a'\vert$$
So, I think this relies on assuming $H$ acts $\vert a' \rangle$, but for the reasons above, I do not understand why this is true.
 A: I will address the second question primarily, because there is an important point here about the notation.
Right from the beginning, the following statement
$$\hat{p} = -i\hbar \partial_x$$
doesn't makes sense, especially when you then go to try and act on abstract ket vectors. The operator $\hat{p}$ is an abstract operator acting on abstract ket-space whose representation in position-space is given by $\frac{\hbar}{i}\frac{\partial}{\partial x}$. You cannot act with $\frac{\hbar}{i}\frac{\partial}{\partial x}$ on kets because these objects live in different worlds.
To explain, note that if we have an abstract ket (quantum state) $\lvert \psi\rangle$, we can compute its expansion coefficients in a basis $\lvert \varphi_n\rangle$ by by computing the inner products $\langle \varphi_n | \psi\rangle$. Then, you can think of $\langle \varphi_n | \psi\rangle$ as the $n$'th element in a column-vector representation of $\lvert \psi\rangle$, i.e.,
$$
\lvert{\psi}\rangle \to
\begin{bmatrix}
\langle \varphi_1 | \psi\rangle \\
\langle \varphi_2 | \psi\rangle \\
\langle \varphi_3 | \psi\rangle \\
\vdots
\end{bmatrix}\,.
$$
In roughly the same way, we can expand the vector in the position eigenbasis (i.e., $\{\lvert x\rangle\}$) by computing the inner products $\langle x | \psi\rangle$. Very roughly speaking, you can think of $\langle x | \psi\rangle$ as an element in a column-vector representation of $\lvert \psi\rangle$, just as above. The problem is that we have continually-many $x$'s, and so a column-vector representation (to the extent that it even makes sense) is computationally intractable. For that reason, we think of $\langle x | \psi \rangle$ as a function $\psi(x) = \langle x | \psi \rangle$ and call it the wave function, although we should really be thinking about it as the position-space representation of the quantum state $\lvert \psi\rangle$.
Now, in order to act with $\hat{p}$, we need to (1) know how $\hat{p}$ acts on the arbitrary state $\lvert\psi\rangle$ (which is usually not possible), (2) work in momentum space, or (3) work in position-space.  The latter is what is relevant here. It turns out that the proper way to understand things is as follows:
$$
\langle x \lvert \hat{p} \rvert \psi \rangle
=
\frac{\hbar}{i}\frac{\partial}{\partial x}\psi(x)\,.
$$
In words, the position space representation of the state $\hat{p}\lvert \psi\rangle$ arrived at by acting with the momentum operator on the quantum state $\lvert \psi\rangle$ is exactly the derivative of $\psi(x)$, up to some constants.  We can derive this by appealing to option (2) above, working the momentum basis and using the commutation relation $\hat{x}$ and $\hat{p}$ or, equivalently, using the Fourier relationship between momentum-space and position-space.

In any case, all of that is to say that something like
$$
\hat{p} = (-i\hbar \partial_x)(\sum_{a'}\vert a' \rangle \langle a' \vert) = -i\hbar(\sum_{a'}\vert a' \rangle \partial_x \langle a' \vert)$$
doesn't make sense, because you are mixing two different representations together, which makes things fall apart.
In the derivation of the propagator done in Sakurai, that basis $\{\lvert a \rangle\}$ is assumed to be the eigenbasis of the Hamiltonian $\hat{H}$, and the abstract operator $\hat{H}$ is allowed only to act on kets $\lvert a\rangle$ and never on the dual vectors $\langle a\rvert$ or anything else. Once the matrix elements
$$
\langle a'' \lvert e^{-i \hat{H}t/\hbar} \rvert a' \rangle
$$
have been computed, then they can be moved anywhere, because they are numbers (complex numbers, sure, but still numbers) and not operators.
To parallel that discussion with the momentum operator, consider the eigenbasis $\{\lvert p \rangle\}$ of the momentum operator, such that
$$
\hat{p}\lvert p \rangle = p \lvert p \rangle\,.
$$
Then, to figure out what $\hat{p}$ looks like explicitly in terms of its eigenbasis, we can write
\begin{align}
\hat{p} &= \left(
\int_{-\infty}^{\infty}dp'\,\lvert p' \rangle\langle p' \rvert
\right)
\hat{p}\left(
\int_{-\infty}^{\infty}dp\,\lvert p \rangle\langle p \rvert
\right)
\\
&=
\int_{-\infty}^{\infty}dp'\,\lvert p' \rangle\langle p' \rvert
\int_{-\infty}^{\infty}dp\,\hat{p}\lvert p \rangle\langle p \rvert
\\
&=
\int_{-\infty}^{\infty}dp\int_{-\infty}^{\infty}dp'\,
\lvert p' \rangle
\langle p' \rvert\hat{p}\lvert p \rangle
\langle p \rvert\,,
\end{align}
and since
$$
\langle p' \rvert\hat{p}\lvert p \rangle
=
\langle p' \rvert {p}\lvert p \rangle
=
p\langle p' | p \rangle
=
p\delta(p-p')\,,
$$
this becomes
\begin{align}
\hat{p} &=
\int_{-\infty}^{\infty}dp\int_{-\infty}^{\infty}dp'\,
\lvert p' \rangle
p\delta(p-p')
\langle p \rvert
\\&=
\int_{-\infty}^{\infty}dp\,p
\lvert p \rangle
\langle p \rvert\,.
\end{align}
Alternatively, if we want to see what $\hat{p}$ looks like explicitly in the position representation, we would use two resolutions of the identity in terms of the position eigenstates instead, and use the fact that
$$
\langle x' \lvert \hat{p} \rvert  x\rangle
=
\delta(x-x') \frac{\hbar}{i}\frac{\partial}{\partial x}\,,
$$
a derivation that you'll see in Sakurai, and in the process of the derivation, you'll see that $\frac{\hbar}{i}\frac{\partial}{\partial x}$ will only be acting on objects that look like $\langle x | \psi \rangle$ and not on kets or bras or anything else.
(Note that the last equation is equivalent with the statement that
$$
\hat{p} = \int_{\infty}^{\infty}dx\,\lvert x\rangle \frac{\partial}{\partial x}\langle x \rvert\,,
$$
where the $\frac{\partial}{\partial x}$ is understood to act to the right, usually after we have applied this to a ket $\lvert \psi\rangle$.
A: I think you might have slightly misunderstood what is going on here. What Sakurai is writing is an expression off the form
$$A = A 1 = A \sum_{n} | n \rangle \langle n | = \sum_{n} A | n \rangle \langle n | = \sum_{n} (A | n \rangle) \langle n |.$$
$A$ enters the sum due to linearity of everything involved. At the last step, notice $A$ is acting on the ket, not on the bra. This is pretty much a statement of the associativity of matrix products. Notice that if we write the same expression with matrices, we have
$$| n \rangle \langle m | = \begin{pmatrix} \cdot \\ \cdot \\ \cdot \end{pmatrix} \begin{pmatrix} \cdot & \cdot & \cdot \end{pmatrix},$$
where the dots denote entries on the vectors (the particular entries are irrelevant for our purposes). Notice then that $A | n \rangle \langle n |$ is an expression that, in terms of matrices, looks like
$$A \left(| n \rangle \langle n |\right) = \begin{pmatrix} \cdot & \cdot & \cdot \\ \cdot & \cdot & \cdot \\ \cdot & \cdot & \cdot \end{pmatrix} \left[\begin{pmatrix} \cdot \\ \cdot \\ \cdot \end{pmatrix} \begin{pmatrix} \cdot & \cdot & \cdot \end{pmatrix}\right] = \left[ \begin{pmatrix} \cdot & \cdot & \cdot \\ \cdot & \cdot & \cdot \\ \cdot & \cdot & \cdot \end{pmatrix} \begin{pmatrix} \cdot \\ \cdot \\ \cdot \end{pmatrix} \right] \begin{pmatrix} \cdot & \cdot & \cdot \end{pmatrix} = \left( A | n \rangle \right) \langle n |,$$
where we used associativity of matrix multiplication.
As for your counterexample, notice that, at least in the way you're writing, $x$ is not a ket, and $\frac{1}{x}$ is not a bra. I suggest writing the same expression using some state $| \psi \rangle$ with $\langle x | \psi \rangle$ (this isn't normalizable, but for these purposes it doesn't really matter) and then writing it all in the position basis. You will notice that $\hat{p} | \psi \rangle \langle \psi |$ actually has the momentum acting only on the ket, not on the bra, because in the position basis this expression reads $\langle x |\hat{p} | \psi \rangle \langle \psi | x' \rangle$, and you could just act with $\hat{p}$ to the left in $\langle x |\hat{p} | \psi$. You don't get a product rule in here.
A: Since I am familiar with Sakurai (I am using it as a primary text in an ongoing course), I feel that I can answer this.
You have misunderstood what is going on here; your first statement about the operator $\hat{p}$ being equivalent to $-i\hbar\partial_{x}$ is not totally correct. As others have pointed out, this is a consequence of being in a coordinate representation, and when we use representations we do not work with the actual ket, $|a\rangle$ (which is an abstract vector), but rather the wavefunction of the ket in that representation.
What this means is that $\hat{p}$ acting on a state is just $\hat{p}|\Psi\rangle$, it is not equal/equivalent to $-i\hbar\partial_{x}|\Psi\rangle$. It is only when you look at a representation in some basis, that you can talk about $-i\hbar\partial_{x}$. In Sakurai's first chapter, in the final sections, he gives a very clear idea of representing the action of the operator $\hat{p}$ in the coordinate basis. You should go through that to realize why there is a problem in your statement. He shows that,
$$ \langle x|\hat{p}|\Psi\rangle \ = \ -i\hbar\frac{\partial}{\partial x}\langle x|\Psi\rangle \ = \ -i\hbar\frac{\partial}{\partial x}\psi(x)$$
The lower cap $\psi$ on the extreme right is a function of the position, and this is the wavefunction in the position representation (which we impose through the inner product in the previous step). Note that the derivative is not acting on a state/ket vector, but a function obtained through an inner product.
As for the second part of your question, as already pointed out by @schris38, the exponent is being expanded,
$$ e^{\hat{\Omega}} \ = \ \mathrm{1} + \hat{\Omega} + \frac{1}{2!}\hat{\Omega}^{2} + ...$$
Here, $\hat{\Omega}$ is some generic operator. If you substitute $-it\hat{H}/\hbar$ in its place, you will get a series in the Hamiltonian. The kets $|a'\rangle$ are the eigenkets of the Hamiltonian, and the Hamiltonian acts on these to return just the eigenvalue, $E_{a'}$. If you work out the algebra properly for this, you will find that you get the expression that he has written.
Best!
A: Okay, now that you edited your question, it makes a bit more sense. I will attempt answering your question, but I do not know if my answer will be to the point, as I have not yet understood 100% what you are asking, but you can always comment and I can always edit.
You say that Sakurai has this expression,
$$e^{-iHt/\hbar}=\sum_{a',a''}
|a''\rangle\langle a''|
e^{-iHt/\hbar}
|a'\rangle\langle a'|$$
which is simply the exponential time-evolution operator multiplied by the completeness relation twice. Here, you have to note that the set of complete states $\{|a\rangle\}$ is a set with eigenstates of the Hamiltonian. This automatically means that
$$H|a\rangle=E_a|a\rangle$$
where $E_a$ is the energy that corresponds to the state $|a\rangle$.
Since the complete set is chosen to be comprised by eigenstates of the Hamiltonian, then
$$H|a\rangle=E_a|a\rangle\Rightarrow 
e^{-iHt/\hbar}|a\rangle=\bigg(1-\frac{iHt}{\hbar}+\frac{1}{2!}\Big(-\frac{iHt}{\hbar}\Big)^2+...\bigg)|a\rangle\\
=\bigg(1-\frac{iE_at}{\hbar}+\frac{1}{2!}\Big(-\frac{iE_at}{\hbar}\Big)^2+...\bigg)|a\rangle
=e^{-iE_at/\hbar}|a\rangle$$
and hence
$$\langle a''|e^{-iHt/\hbar}|a'\rangle=
e^{-iE_{a'}t/\hbar}\langle a''|a'\rangle=
e^{-iE_{a'}t/\hbar}\delta_{a'',a'}$$
This would give you the desired result
$$e^{-iHt/\hbar}=\sum_{a'}|a'\rangle e^{-iE_{a'}t/\hbar}\langle a'|=
\sum_{a'}e^{-iE_{a'}t/\hbar}|a'\rangle \langle a'|$$
