Thailand's age of consent is 15 but a higher minimum age of 18 applies in the case of prostitutes. Thai penalties for sex with minors are harsh, and even if your partner is over the age of consent in Thailand, tourists who have sex with minors may be prosecuted by their home country. As far as ascertaining the age of your partner goes, all adult Thais must carry an identity card, which will state that they were born in 2535 or earlier if they were over the age of 18 on January 1, 2010 (in the Thai calendar, AD 2010 is the year 2553).
Some prostitutes are "freelancers", but most are employed by bars or similar businesses and if hiring a prostitute from a bar or similar business, you will have to pay a fee for the establishment called a "bar fine". This entitles you to take them out of their place of employment; it does not pay for any bedroom gymnastics.
Bar girls, gogo girls and freelancers are all professionals, who are far more likely to be interested in money you can give them than in any continuing relationship for its own sake. Cases of visitors falling desperately in love and then being milked out of all they are worth abound. Thailand has a high rate of STD infection, including HIV/AIDS, both among the general population and among prostitutes. Condoms can be bought easily in Thailand in all convenience shops and pharmacies but may not be as safe as Western ones.
Technically, some aspects of prostitution in Thailand are illegal (e.g., soliciting, pimping), but enforcement is liberal and brothels are commonplace. It's not illegal to pay for sex due to the "Special Services" exemption in Thai law or to pay a "bar fine".
Thailand Travel/Vacation Photos