$ty'(t) + y(t) = -e^{-t}$ Solve the IVP
\begin{align}
  &ty'(t) + y(t) = -e^{-t}, \quad 0 < t < \infty \\
  & y(0)=0
\end{align}

First my trial: 
I am trying to solve this by finding homogeneous solution $y_h$ and particular solution $y_p$. 
\begin{align}
t\frac{dy}{dt} = -y \quad \Rightarrow \quad  -\frac{1}{y} dy = \frac{1}{t} dt \quad \Rightarrow \quad -\ln(y) = \ln(t) + C \quad \Rightarrow \quad y = \frac{C}{t}
\end{align}
What about particular solution? 
 A: Integrating with respect to $t$ gives
$$ty(t)=e^{-t}+A$$
and $y(0)=0$ means $A=-1$, so $y(t)=\frac{e^{-t}-1}{t}$ when $t\ne0$
A: For obtaining the general solution one usually can use the method called 'variation of parameters'. In your homogenous solution, assume that $C$ is a differentiable function of $t$, i. e., 
$$y = \frac{C(t)}{t}.$$
Plug this into your equation, which will lead you to 
$$C'(t) = - \mathrm e^{-t}$$
and therefore
$$C(t) = \mathrm{e}^{-t} + k,$$
where $k \in \mathbb{R}$. So the general solution of your equation is 
$$y(t) = \frac{\mathrm{e}^{-t} + k}{t}.$$
You can now plug in the initial values in order to obtain the solution of the IVP.

If you want to use a trial-and-error-method, you can do the following: Rewrite you equation as
$$y'(t) + \frac{y(t)}{t} = - \frac{\mathrm e^{-t}}{t}.$$
Based on the force function on the right hand side, you can make the Ansatz
$$y_{\text{p}}(t) = \frac{A\mathrm e^{-t}}{t}$$
with $A \in \mathbb{R}$. Plug this into your equation and you will obtain $A = 1$.
