The underlying principles are straightforward. The ground state is the solution of the Schrödinger equation with the lowest possible energy. One way to find a function that approximates the ground state is to create some form of expansion, such as a Fourier series, with variable expansion coefficients. Any given set of expansion coefficients equates to a particular wave function, for which you can readily calculate an associated energy expectation value. You can now vary the expansion coefficients to see what effect the variation has on the energy expectation value. If the change in the coefficients reduces the energy, then the expansion must have become closer to the ground state (ie to the function that has the lowest possible energy). In practice what you do is to program an algorithm which varies the coefficients in a systematic way to home in on a set that appears to minimise the energy expectation value. Once you've arrived at a set that seems to give the lowest energy value, then you can take the Fourier expansion with those coefficients as being your best approximation to the ground state.
I've mentioned a Fourier series because that's a familiar example of an expansion that most readers of this answer are likely to understand. In practice, however, you will pick an expansion that you think will be a good fit to the physical arrangement you are trying to model. For example, to model electrons in a spherical potential, plane waves are unlikely to be a good basis for an expansion, so you might use spherical Bessel functions, say, instead.