Most knitting needles -- at least those recently produced -- make it easy for you to figure out what size they are. Straight needles usually have a knobby bit at the end that has the number (US or UK) and often the metric measurement (in millimeters) as well.
Circular needles can be a little trickier. If the needle is not part of an interchangeable set, the size is usually printed on the needle near the point where the needle part joins the circular part. If it's part of a set, your storage case will have spaces marked for each size, but the needles themselves won't indicate what size they are.
Handmade needles, double-pointed needles, antique needles and other needles made of specialty materials might not have a size marking. Sometimes needles are marked originally but the marking wears off with time and use.
Get a Gauge Ruler
The tool you need to figure out what size your needles are is called a gauge ruler. This little metal ruler has an L-shaped hole in it to allow you to measure your gauge swatch accurately, but it also has holes that correspond to the sizes of some of the most common needles.
To test a needle, slide it into one of the holes. Keep trying until you find the one that it can just fit through without any (or much) wiggle room. That's what size your needle is.
You can also get a knitting needle gauge that just includes the holes and is not also a gauge ruler. This is fine, too, but a little multitasking never hurt anyone.
Some knitters will recommend that you have a gauge ruler or needle gauge that was manufactured by the company that made your needles, which is great, if you know who made your needles. The truth is that there will be slight variations among manufacturers even when you're measuring needles you know are the same size, so it certainly doesn't hurt to have a couple of different measuring tools. (It also doesn't hurt not to get too hung up on needle size and instead pay attention to the gauge you are getting with your particular yarn and stitch pattern.)
If you'd like to not have to measure your unlabeled needles each time you use them, you can mark them yourself with a small piece of tape. Or use different colors of nail polish to color-code needles: just swipe a little color on the end of each needle, then put your code on an index card.
You can also store needles so that you know which needles are which size. A large plastic zip-top bag will hold most needles and you can write the size on the outside. Or if you have a fabric needle holder that rolls up, you can label the slots or arrange your needles in size order.