Well, (especially for projects such as hats) I like to use the mattress stitch or sew invisible seams. I learnt about this method from knitwear designer Lucy Neatby.
Arrange the two edges so that they are parallel.
Thread the yarn tail into a darning needle.
Start sewing at the edge opposite the edge where you obtained the yarn tail. Using the threaded darning needle, weave the yarn back and forth from one edge to another. Ensure the edges remain parallel. Once finished weave in the ends and cut the yarn tail.