I'm working through an example in boundary value problems which is about a bar of length 2 that is initially at $0^{\circ}$. From $t = 0$ on, the $x = 0$ end is held at $0^{\circ}$ and the $x = 2$ end at $100^{\circ}$.
So the initial condition is $$u(x,0)=50x $$
and the boundary conditions are $$u(0,t)=0$$ $$ u(2,t)=100$$
Using $u(0,t)=0$ gives the form $$u(x,t)=c_0 \sin(kx) e^{-\alpha^2k^2 t}$$
but next they say that using $u(2,t)=100$ gives $\sin(2k)=0$ which doesn't make any sense to me because literally it gives $$100=c_0 \sin(2k) e^{-\alpha^2k^2 t}$$
Is $u(2,t)=100$ used correctly here? What am I missing?
Here's a guide on how to provide context, so you can ask a better question next time. You did not provide the full PDE, or even the full solution from your textbook. With so much missing information, this should be flagged as "missing context".
I'm going to read between the lines to infer that the full equation is
$$ u_t - \alpha^2u_{xx} = 0 $$
With boundary conditions $$u(0,t) = 0,\quad u(2,t) = 100 $$
and initial condition $$ u(x,0) = 0 $$
where $u$ is the temperature of the bar. Now, you might think the initial condition is inconsistent with the boundary temperature are $x=2$. You can reconcile them by considering that at time $t=0$, $u=0$ for $0 \le x < 2$ and $u=100$ only at a point $x=2$. This might not make physical sense, but the math will work out.
Moving on, since the boundary conditions are inhomogeneous, you'll want to split it up into two pieces
$$ u(x,t) = v(x,t) + w(x) $$
where $w(x)$ is the steady-state solution, and $v(x,t)$ is the transient (or homogenous) solution. Some texts may use the same letter for these solution, so that might have been what confused you.
First off, the steady-state solution is one that satisfies the heat equation, except with $w_t=0$. This is the temperature distribution the bar will reach after an indefinitely long time. It also matches the temperature at the endpoints, thus you have
$$ \alpha^2w_{xx} = 0 $$ $$ w(0) = 0, \quad w(2) = 100 $$
Solving the above ODE gives $w(x) = 50x$. This is also what you incorrectly have as the initial condition.
Now for the other solution. It's called the transient solution because it will decay to $0$ as $t \to \infty$, as you will see later.
Plugging in $u = v + w$ to the original equation, we have
$$ (v_t + w_t) - \alpha^2(v_{xx} + w_{xx}) = 0 \implies v_t - \alpha^2 v_{xx} = 0 $$
Due to linearity, $v(x,y)$ must also satisfy the heat equation, except the boundary conditions are now homogeneous, since
$$ v(0,t) = u(0,t) - w(0) = 0 $$ $$ v(2,t) = u(2,t) - w(2) = 0 $$
And the initial condition is now
$$ v(x,0) = u(x,0) - w(x) = -50x $$
Using separation of variables, we can obtain a particular solution of the form
$$ v_p(x,t) = \big[a\sin(kx) + b\cos(kx)\big] e^{-\alpha^2k^2t} $$
The first B.C $v(0,t)=0$ gives $b=0$, as you've already done, so
$$ v_p(x,t) = a\sin(kx) e^{-\alpha^2k^2t} $$
The second B.C. is also $v(2,t)=0$, so this gives
$$ \sin(2k) = 0 \implies 2k = n\pi $$
where $n$ is an integer, so we can write.
$$ v_n(x,t) = a\sin\left(\frac{n\pi}{2}x\right)e^{-\alpha^2(\frac{n\pi}{2})^2t} $$
Since any value of $n$ will satisfy the equation, we must use the law of superposition to get the full solution
$$ v(x,t) = \sum_n c_nu_n(x,t) = \sum_{n=1}^\infty c_n \sin\left(\frac{n\pi}{2}x\right)e^{-\alpha^2(\frac{n\pi}{2})^2t} $$
From here on, all that's needed is to match up the initial condition
$$ v(x,0) = -50x = \sum_{n=1}^\infty c_n \sin\left(\frac{n\pi}{2}x\right) $$
The constants $c_n$ are derived from the Fourier series expansion
$$ c_n = \int_0^2 (-50x) \sin\left(\frac{n\pi}{2}x\right)\ dx = -\frac{4}{n\pi}(-1)^n $$
Putting everything together, we have the final temperature distribution
$$ u(x,t) = 50x - \sum_{n=1}^\infty \frac{4(-1)^n}{n\pi} \sin\left(\frac{n\pi}{2}x\right)e^{-\alpha^2(\frac{n\pi}{2})^2t} $$