1) Whenever one has a topological vector space (TVS) $V$ over some field $\mathbb{F}$, one can construct a dual vector space $V^*$ consisting of continuous linear functionals $f:V\to\mathbb{F}$.
2) Under relative mild conditions on the topology of $V$, it is possible to turn the dual vector space $V^*$ into a TVS. One may iterate the construct of dual vector spaces, so that more generally, one may consider the double-dual vector space $V^{**}$, the triple-dual vector space $V^{***}$, etc.
3) There is a natural/canonical injective linear map $i :V\to V^{**}$. It is defined as
$$i(v)(f):=f(v),\qquad\qquad v\in V, \qquad\qquad f\in V^*. $$
4) If the map $i$ is bijective $V\cong V^{**}$, one says that $V$ is a reflexive TVS.
5) If $V$ is an inner product space (which is a particularly nice example of a TVS), then there is a natural/canonical injective conjugated linear map $j :V\to V^*$. It is defined as
$$j(v)(w):=\langle v, w \rangle ,\qquad\qquad v,w\in V. $$
Here we follow the Dirac convention that the "bracket" $\langle\cdot, \cdot \rangle$ is conjugated linear in the first entry (as opposed to a lot of the math literature).
6) Riesz representation theorem (RRT) shows that $j$ is a bijection if $V$ is a Hilbert space. In other words, a Hilbert space is selfdual $V\cong V^*$. If one identifies $V$ with the set of kets, and $V^*$ with the set of bras, one may interpret RRT as saying that there is a natural/canonical one-to-one correspondence between bras and kets.
To show that a general operator $\hat{A}$ commutes with some function of $\hat{A}$, $\hat{B} = f(\hat{A})$, one must only use the fact that $\hat{A}$ commutes with itself raised to some power, $[\hat{A},\hat{A}^n] = 0$. This is done by expanding the function $f$ in a Taylor series
$$f(\hat{A}) = \sum_{n=0}^\infty \frac{\hat{A}^n}{n!}$$
Now the commutator (using the fact that the commutator is linear)
$$[\hat{A},f(\hat{A})] = [\hat{A},\sum_{n=0}^\infty \frac{\hat{A}^n}{n!}] = \sum_{n=0}^\infty \frac{1}{n!}[\hat{A},\hat{A}^n]$$
As $\hat{A}$ always commutes with itself, the commutator is zero.
Best Answer
Write $|A\rangle = \sum_i a_i|i\rangle$: you know you can do this because $\left\{|i\rangle\right\}$ are a basis: this is the definition of a basis. Further, they are orthonormal which means that $\langle i|j\rangle = \delta_{ij}$ (this is what being orthonormal means). So now consider $$\begin{align} \langle j|A\rangle &= \langle j|\left(\sum_i a_i|i\rangle\right)\\ &= \sum_i a_i\langle j|i\rangle\\ &= \sum_i a_i \delta_{ji}\\ &= a_j \end{align}$$
As required. The intermediate steps are just moving the basis vector into the sum.
(The answer by CDCM is better than this one, I think).