I assume you're asking about marijuana. My answer assumes you smoked once and have not done so in awhile and are not, nor were you, a regular smoker.
Now, in your blood, it could last from a few hours to a few days. In the blood they measure active metabolites of thc. This one will be negative soonest.
In a ua (urine anaylsis), it will typically be 3-7 days. With that said, because thc is fat soluable, the more body fat you have, the longer it will stay. If you smoked daily for months, people have tested positive for up to 90 days although people usually say 45 days is good. Here they are not testing for thc but its converted metabolite.
Hair is more tricky and less reliable. Hair tests actually aren't fully reliable for thc. However, should it show up, it will simply be in your hair until it grows out and you cut if off. Typically they test the root which you wouldn't be able to shave for a period, but dependiing on the length of your hair, they can theoretically measure your drug use dating back since your last hair cut.
While I have had no legal problems, I know this to be true having been tested over it in various college classes ranging from studying drug use to pharmacology with my double major.