I've done that many times too

and because by the time I address the problem, it's too late to buy the same dye lot, have gone to the trouble of untangling.
If you've found both ends you're ahead of the game. Just methodically pull the ends through the knots FROM the knot. Often, if you cannot loosen the yarn with your fingers, a knitting needle or blunt needlepoint needle can be worked in under the strand to pull it free.
As you work, keep the ends on opposite sides of yourself to prevent them from finding a way to knot up again!
It is recommended that you don't try to rush this, as it really does take patience - do it while watching TV, and if you have cats, be sure and put them in another room.
And unless the project is something you really, really want to finish and don't have enough yarn otherwise, you may save alot of frustration by just chucking it and make something else out of the yarn that's left.
