Most items have a set number -- before the Scout update introduced the Sandman, no item went higher than level 10.
About the time of the Spy / Sniper update, there was a glitch in the random drop system, and normal weapons (that usually have a fixed level number) were generated with a random level between one and one hundred. This has since been fixed, so if you see, to use one of my own items for example, a level 56 Dead Ringer, that means the item is very old. (And now with the latest patch, you'll never see a non-vintage oddly leveled item)
On the other hand, hats will always have a random level. This means nothing, but certain levels are certainly more valuable for trading, for pure sentimental value. (1, 100, 69, 42, etc.)
The singular exception to all of the above is the new Dueling Badge medal misc item, which actually "levels up" as you kill folks during your duels. A level 100 dueling badge works out to 1000 kills (Might be off a factor of ten) during duels, and likewise the rarity of the badge itself (bronze, silver, gold, platinum) is based on level increment. 0-25,26-50,51-75,76-99,100, etc.
In no case does the level of an item have any effect on gameplay.
As nimcap answered, unusual hats are just hats with special particle effects. They have no stat benefits, only visual effects.
The only way to obtain them is to trade for them or to find one in a Mann Co Supply Crate. Crates have a low chance to contain an unusual hat.
According to data gathered by users on the forums, it seems that series 1 crates have about 2.45% chance of containing an unusual item, and series 2 crates have about a 1.5% chance. You can tell which series of crate you have by reading the tooltip.
To open the crate you need to buy a Mann Co. Supply Crate Key, which costs $2.49 in the store. If you'd rather not spend money you can trade the crate to someone. Items that come out of crates are craftable and tradeable.
You can find more details about the drop rate on the TF2 wiki page about crates. Keep in mind that this data is gathered by players and might not be totally accurate, but it's probably in the ballpark.
Best Answer
Use tf2ls and choose the "Extras" option, or "Text Output" for text instead of icons.