Here is a lesson I learned the hard way and years too late, so I'm gonna tell you all right now:
Leave long tails and weave in your ends! You know what I'm talking about - this is the first and last instruction on any knitting pattern. You especially need to do this when changing yarns throughout your work, but, yes, also at the beginning and ends. This is not just because of unsightly knots on scarves - I used to think that if I was knitting a hat or a sweater, that I could just knot the two yarns together on the inside and cut the ends short. Nonononono. This leads to holes and unhappiness and knitted objects of little integrity.
I made my mom a sweater for her birthday (or maybe Christmas?) once, and she came to me with it a few months later full of holes! Totally embarrassing, especially since I told her the thing was machine washable - the yarn was fine in the machine, it didn't shrink or bleed, but my shoddy craftsmanship made it not-so-washable. Granted it was made of a particularly slippery yarn and there was a lot of color changing throughout the sweater, but this could happen to just about any piece.
So here is a sort of tutorial, for those, like myself who knit on the fly and might only recently have learned to read patterns an might not have always know what it means to weave in ends and why, and sometimes like to ignore rules when i don't know their purpose.
In the above photo is the inside of a sleeve revealing all the naked ends. Remember, leave them long, at least 3 inches, so that they can be threaded into a needle and treated right - you can always trim them (a little) later. To my left here is one of those ends being woven back into the piece. Use a tapestry needle and just go through the tops of a row of stitches, making sure that it doesn't show on the face of the piece. This is pretty easy if you go across a row - if you want to travel down a column of stitches (works well if you are weaving ends into a rib) then you want to skip every other stitch, or it will definitely show on the face of the work; you will essentially just be transfering the end to the front of the work :/ I usually try to weave through a stripe the same color as the yarn end to be double sure.
To the right you can see a couple of properly woven ends - green through a green stripe and white through a white stripe. You can also see some already trimmed ends in the top of the picture. And lastly, down below is the finished product - once you've woven the ends through an inch or two of fabric, you have my permission to trim what is left dangling (be careful not to snip and stitches though).
Now go forth and be happy knitters, confident in the fact that you are knitting pieces of art that will endure for longer than they would have when you were in that nasty habit of snipping so close to the knots (or was that only me?