Hello my electrical engineering teacher gave me those formulas when teaching how to solve electrical circuits using Laplace transforms. Having a polynomial $Q(s)$ of degree $n$ and $P(s)$ with degree $m$ the if $m<n$ and $$F(s)=\frac{Q(s)}{P(s)}$$ then the inverse Laplace transform is given by $$f(t)=\sum_{k=1}^n\frac{P(s_k)}{Q'(s_k)}e^{s_kt}$$ also if $$F(s)=\frac{P(s)}{sR(s)}$$ then $$f(t)=\frac{P(0)}{R(0)}+\sum_{k=1}^{n-1}\frac{P(s_k)}{s_kR(s_k)}e^{s_kt}$$ and $s_k$ are the roots of the polynomial in the denominator. Now I have studied Laplace transform in math class, however my math teacher did not proved or mention those formulas. All that I found related to this was on this answer: https://math.stackexchange.com/a/248355/515527
Could you perhaps give me some intuition or a proof for these theorems, even though it is used in electrical engineering I think I can make use of it everytime I have to do ILT.
$\DeclareMathOperator{\Re}{Re}\DeclareMathOperator{\Im}{Im}\DeclareMathOperator{\Res}{Res}\def\e{\mathrm{e}}\def\i{\mathrm{i}}\def\d{\mathrm{d}}$In fact, your first formula should be for $F(s) = \dfrac{P(s)}{Q(s)}$ where $\deg P < \deg Q$ and all zeros of $Q$ are simple, and the second one should be$$ \mathcal{L}^{-1}(F)(t) = \frac{P(0)}{R(0)} + \sum_{k = 1}^n \frac{P(s_k)}{s_k R'(s_k)} \e^{s_k t} $$ where $n = \deg R \geqslant \deg P$ and all zeros of $s R(s)$ are simple.
Lemma: Denote$$ γ(a, r; θ_1, θ_2) = \{a + r\e^{\i θ} \mid θ_1 < θ < θ_2 \},\\ D(a, r) = \{z \in \mathbb{C} \mid \Re z < a,\ |z - a| > r \},\\ E(a, r) = \{z \in \mathbb{C} \mid \Im z > 0,\ |z - a| > r \}. $$ If $f$ is continuous on $D(a, r_0)$ and $\lim\limits_{\substack{|z| → ∞\\z \in D(a, r_0)}} f(z) = 0$, then$$ \lim_{r → ∞} \int\limits_{γ(a, r; \frac{π}{2}, \frac{3π}{2})} f(z) \e^{tz} \,\d z = 0. \quad \forall t > 0 $$
Proof: By making substitution $w = -\i(z - a)$,$$ \int\limits_{γ(a, r; \frac{π}{2}, \frac{3π}{2})} f(z) \e^{tz} \,\d z = \int\limits_{γ(0, r; 0, π)} f(\i w + a) \e^{t(\i w + a)} \,\d w = \e^{ta} \int\limits_{γ(0, r; 0, π)} f(\i w + a) \e^{\i tw} \,\d w. $$ Because $g(w) := f(\i w + a)$ is continuous on $E(0, r_0)$ and$$ \lim_{\substack{|w| → ∞\\w \in E(0, r_0)}} g(w) = \lim\limits_{\substack{|w| → ∞\\w \in E(0, r_0)}} f(\i w + a) = \lim_{\substack{|z| → ∞\\z \in D(a, r_0)}} f(z) = 0, $$ by Jordan's lemma,$$ \lim_{r → ∞} \int\limits_{γ(a, r; \frac{π}{2}, \frac{3π}{2})} f(z) \e^{tz} \,\d z = \e^{ta} \lim_{r → ∞} \int\limits_{γ(0, r; 0, π)} g(w) \e^{\i tw} \,\d w = 0. $$
Now back to find $\mathcal{L}^{-1}(F)$ for $F(s) = \dfrac{P(s)}{Q(s)}$ where $\deg P < \deg Q$ and all zeros of $Q$ are simple. $Q$ can be written as $Q(s) = c \prod\limits_{k = 1}^n (s - s_k)$ where $c \in \mathbb{C}^*$ and $s_1, \cdots, s_n$ are distinct complex numbers, thus all singularities of $F$ are $s_1, \cdots, s_n$. By taking $a = \max\limits_{1 \leqslant k \leqslant n} \Re s_k + 1$,$$ \mathcal{L}^{-1}(F)(t) = \frac{1}{2π\i} \lim_{r → ∞} \int_{a - \i r}^{a + \i r} F(s) \e^{ts} \,\d s. \quad (t > 0) $$ Denote $r_0 = \max\limits_{1 \leqslant k \leqslant n} |s_k|$, then $F$ is continuous on $D(a, r_0)$ and $\deg P < \deg Q$ implies $\lim\limits_{\substack{|z| → ∞\\z \in D(a, r_0)}} F(z) = 0$. For any $r > r_0$, by the residue thorem,$$ \frac{1}{2π\i} \int_{a - \i r}^{a + \i r} F(z) \e^{tz} \,\d z + \frac{1}{2π\i} \int\limits_{γ(a, r; \frac{π}{2}, \frac{3π}{2})} F(z) \e^{tz} \,\d z = \sum_{k = 1}^n \Res(F(z) \e^{tz}, s_k). $$ Thus by the lemma,$$ \frac{1}{2π\i} \lim_{r → ∞} \int_{a - \i r}^{a + \i r} F(s) \e^{ts} \,\d s = \sum_{k = 1}^n \Res(F(z) \e^{tz}, s_k). $$ Now, note that $Q'(z) = c\sum\limits_{k = 1}^n \prod\limits_{j ≠ k} (z - s_j)$. For each $k$, since $s_1, \cdots, s_n$ are distinct, then$$ (z - s_k)F(z) \e^{tz} = \frac{P(z)}{c\prod\limits_{j ≠ k} (z - s_j)} \e^{tz}$$ is holomorphic in a neighborhood of $s_k$. Thus$$ \Res(F(z) \e^{tz}, s_k) = \lim_{z → s_k} (z - s_k)F(z) \e^{tz} = \frac{P(s_k)}{c\prod\limits_{j ≠ k} (s_k - s_j)} \e^{t s_k} = \frac{P(s_k)}{Q'(s_k)} \e^{t s_k}, $$ where the last step is because $\prod\limits_{j ≠ k'} (s_k - s_j) = 0$ for $k' ≠ k$. Therefore,$$ \mathcal{L}^{-1}(F)(t) = \sum_{k = 1}^n \Res(F(z) \e^{tz}, s_k) = \sum_{k = 1}^n \frac{P(s_k)}{Q'(s_k)} \e^{s_k t}. $$
For the second formula, take $Q(s) = s R(S)$. Since zeros of $Q$ are $s_0 = 0, s_1, \cdots, s_n$ and $Q'(s) = R(s) + s R'(s)$, then$$ \mathcal{L}^{-1}(F)(t) = \sum_{k = 0}^n \frac{P(s_k)}{Q'(s_k)} \e^{s_k t} = \frac{P(s_0)}{Q'(s_0)} \e^{s_0 t} + \sum_{k = 1}^n \frac{P(s_k)}{Q'(s_k)} \e^{s_k t} = \frac{P(0)}{R(0)} + \sum_{k = 1}^n \frac{P(s_k)}{s_k R'(s_k)} \e^{s_k t} $$