Solving trigonometric equations of the form $a\sin x + b\cos x = c$
The idea is to use the identity $\sin(\alpha+\beta)=\sin\alpha\cos\beta+\cos\alpha\sin\beta$. You have $a\sin x+b\cos x$, so you’d like to find an angle $\beta$ such that $\cos\beta=a$ and $\sin\beta=b$, for then you could write
$$a\sin x+b\cos x=\cos\beta\sin x+\sin\beta\cos x=\sin(x+\beta)\;.$$
The problem is that $\sin\beta$ and $\cos\beta$ must be between $-1$ and $1$, and $a$ and $b$ may not be in that range. Moreover, we know that $\sin^2\beta+\cos^2\beta$ must equal $1$, and there’s certainly no guarantee that $a^2+b^2=1$.
The trick is to scale everything by $\sqrt{a^2+b^2}$. Let $A=\dfrac{a}{\sqrt{a^2+b^2}}$ and $B=\dfrac{b}{\sqrt{a^2+b^2}}$; clearly $A^2+B^2=1$, so there is a unique angle $\beta$ such that $\cos\beta=A$, $\sin\beta=B$, and $0\le\beta<2\pi$. Then
$$\begin{align*} a\sin x+b\cos x&=\sqrt{a^2+b^2}(A\sin x+B\cos x)\\ &=\sqrt{a^2+b^2}(\cos\beta\sin x+\sin\beta\cos x)\\ &=\sqrt{a^2+b^2}\sin(x+\beta)\;. \end{align*}$$
If you originally wanted to solve the equation $a\sin x+b\cos x=c$, you can now reduce it to $$\sqrt{a^2+b^2}\sin(x+\beta)=c\;,$$ or $$\sin(x+\beta)=\frac{c}{\sqrt{a^2+b^2}}\;,$$ where the new constants $\sqrt{a^2+b^2}$ and $\beta$ can be computed from the given constants $a$ and $b$.
Using complex numbers, and setting $z=e^{i\theta}$,
$$a\frac{z-z^{-1}}{2i}+b\frac{z+z^{-1}}2=c,$$ or
$$(b-ia)z^2-2cz+(b+ia)=0.$$
The discriminant is $c^2-b^2-a^2:=-d^2$, assumed negative, then the solution
$$z=\frac{c\pm id}{b-ia}.$$
Taking the logarithm, the real part $$\ln\left(\dfrac{\sqrt{c^2+d^2}}{\sqrt{a^2+b^2}}\right)=\ln\left(\dfrac{\sqrt{c^2+a^2+b^2-c^2}}{\sqrt{a^2+b^2}}\right)=\ln(1)$$ vanishes as expected, and the argument is
$$\theta=\pm\arctan\left(\frac dc\right)+\arctan\left(\frac ab\right).$$
The latter formula can be rewritten with a single $\arctan$, using
$$\theta=\arctan\left(\tan(\theta)\right)=\arctan\left(\frac{\pm\dfrac dc+\dfrac ab}{1\mp\dfrac dc\dfrac ab}\right)=\arctan\left(\frac{\pm bd+ac}{bc\mp ad}\right).$$
Riffing on @Yves' "little known" solutions ...
The above trigonograph shows a scenario with $a^2 + b^2 = c^2 + d^2$, for $d \geq 0$, and we see that $$\theta = \operatorname{atan}\frac{a}{b} + \operatorname{atan}\frac{d}{c} \tag{1}$$ (If the "$a$" triangle were taller than the "$b$" triangle, the "$+$" would become "$-$". Effectively, we can take $d$ to be negative to get the "other" solution.) Observe that both $c$ and $d$ are expressible in terms of $a$, $b$, $\theta$: $$\begin{align} a \sin\theta + b \cos\theta &= c \\ b \sin\theta - a\cos\theta &= d \quad\text{(could be negative)} \end{align}$$ Solving that system for $\sin\theta$ and $\cos\theta$ gives $$\left.\begin{align} \sin\theta &= \frac{ac+bd}{a^2+b^2} \\[6pt] \cos\theta &= \frac{bc-ad}{a^2+b^2} \end{align}\quad\right\rbrace\quad\to\quad \tan\theta = \frac{ac+bd}{bc-ad} \tag{2}$$ We can arrive at $(2)$ in a slightly-more-geometric manner by noting $$c d = (a\sin\theta + b \cos\theta)d = c( b\sin\theta - a \cos\theta ) \;\to\; ( b c - a d)\sin\theta = \left( a c + b d \right)\cos\theta \;\to\; (2) $$ where each term in the expanded form of the first equation can be viewed as the area of a rectangular region in the trigonograph. (For instance, $b c \sin\theta$ is the area of the entire figure.)