The Pauli matrices, together with the identity, form an orthonormal basis for a vector space of $2 \times 2$ matrices. As a result, we can express a matrix $A$ as a linear combination of these basis vectors (Pauli + Identity matrices). The coefficients in the linear combination can be expressed with the Hilbert-Schmidt inner product, which is defined as $Tr(U^{\dagger}W)$ for some $2 \times 2$ matrices $U$ and $W$. This is why we can rewrite $A$ as follows:
$$
\tag{1} A = \frac{1}{2}\bigl(Tr(AI) I + Tr(AX)X + Tr(AY)Y + Tr(AZ)Z\bigr).
$$
In the above equation, daggers (conjugate transposes) disappear because Pauli matrices are Hermitian.
The second part of your question relies on a similar basic fact. Any Hermitian matrix can be rewritten as a linear combination of rank-one projectors given by the eigenvectors of a matrix. This is known as spectral decomposition. Hence, we can express Pauli-Z as
$$Z = |0\rangle \langle 0| - |1\rangle \langle 1|.$$
Note that $|0\rangle$ and $|1\rangle$ are eigenvectors of $Z$ with eigenvalues +1 and -1, respectively.
Similarly, we can express Pauli-X and Y as
\begin{align}
X &= |+\rangle \langle +| - |-\rangle \langle -|,\\
Y &= |+i\rangle \langle +i| - |-i\rangle \langle -i|.
\end{align}
Finally, we use the resolution of the identity:
$$\tag{2} I = |0\rangle \langle 0| + |1\rangle \langle 1|.$$
Now, substitute these decompositions into Eq (1) and rearrange all terms to get $A_i$. Getting $A_1$ and $A_2$ should be really trivial at this point, just simple algebra and grouping some terms.
Getting $A_3$ and $A_4$ is a bit trickier but still can be readily seen by inspection.
I will write out $A_3$ as an example. First, I hope it is obvious that $A_3 = Tr(AX)X$. This can be readily seen by looking at the prefactor $Tr(AX)$ in Eq (1) and then observing that $A_3$ has the same prefactor. Hence, all we need to do is to express $X$ in terms of projectors $|+\rangle\langle+|, |0\rangle\langle0|$ and $|1\rangle\langle1|$, this will give us $A_3$. Note that
$$2|+\rangle\langle+| = \begin{pmatrix}
1 && 1\\
1 && 1
\end{pmatrix}.
$$
If we add $-I$, which can be decomposed as in Eq (2) we get
\begin{align*}
&2|+\rangle\langle+| - I \\
&= 2|+\rangle\langle+| - |0\rangle\langle0| - |1\rangle\langle1|\\
&= \begin{pmatrix}
1 && 1\\
1 && 1
\end{pmatrix}
-
\begin{pmatrix}
1 && 0\\
0 && 1
\end{pmatrix}
=
\begin{pmatrix}
0 && 1\\
1 && 0
\end{pmatrix} = X.
\end{align*}
Hence, we have
$$A_3 = Tr(AX)X = Tr(AX) \left(2|+\rangle\langle+| - |0\rangle\langle0| - |1\rangle\langle1|\right).$$
You can use a similar derivation to get $A_4$.