I read in my textbook that if we add two functions (with domain $D_1$ and $D_2$), the domain of resulting function is $\displaystyle{D_1 \cap D_2}$.
Now, if we add $f(x)=\ln(1-x)$ and $ g(x)=\dfrac{1}{\sqrt{x-1}}$. The domain of $p(x)=f(x)+g(x)$ is an empty set, so there is "no graph" for this function $p(x)$. How to interpret this?
However, if I take the derivative of this function, I obtain a graph. How is this possible? The function itself did not exist, but we have a slope(derivative) for that function which is represented graphically?
Yes, you cannot add numbers that don't exist. So, for $f(x)+g(x)$ to be defined, you need both $f(x)$ and $g(x)$ to be defined, which means that $x$ is in $d_1=dom(f)$ and in $d_2=dom(g)$. Therefore, the domain of $f+g$ is $d_1\cap d_2=dom(f)\cap dom(g)$.
Yes, since $dom(f)=(-\infty,1)$ and $dom(g)=[1,\infty)$, their intersection is empty, so the domain of $p$ is empty.
If a function is differentiable at $a$, then it is defined at $a$ (by definition of the derivative). By contraposition, since there is no number $a$ where $p$ is differentiable, then $p$ is not differentiable.
Note that the derivative of $f(x)=\ln(1-x)$ is $f'(x)=\frac{-1}{1-x}$ with $dom(f')=(-\infty, 1)$, not $dom(f')=\mathbb R\setminus \{ 1 \}$.