The Black Scholes model assumes the following underlying dynamics, known as Geometric Brownian Motion: $$dS_t=S_t(\mu dt+\sigma dW_t)$$
Then the solution is given: $$S_t=S_0\,e^{\left(\mu-\frac{\sigma^2}{2}\right)t+\sigma W_t}$$
It can be shown by Ito Lemma on function $f(t,W_t)=\ln S_t$ that this solution is correct as it leads to above dynamics.
But how do we solve the above SDE originally to find this solution?
Guessing the above solution to apply Ito seems unlikely to me.