If you meet certain criteria, most foreign visitors (including UK, US, Australia, Canada, Ireland, New Zealand and South Africa) do not need to apply for a visa in advance. On arrival, Thai immigration will automatically stamp your passport granting you a 30 day stay in Thailand. If you know in advance of your visit that you will be staying longer than 30 days, I would recommend applying for a 60-day tourist visa from the nearest Thai embassy or consulate in your home country. These can normally be extended by another 30 days in Thailand upon payment of the appropriate fee (currently 1900 Baht). There are slightly different rules depending on your nationality and it is always advisable to check with the Thai embassy or consulate in your home country before departure.
More details available from the visa section of this website.
There are a number of other types of visa available depending on whether you will be working, volunteering or retiring in Thailand and again the advice is to check with the Thai embassy or consulate in your home country as rules and regulations are subject to change.
A word of warning for those travelling on a one-way ticket. A number of airlines do not allow you to travel on a one-way ticket to Thailand regardless of whether you have a bona-fide visa in advance. This is down to the airline’s own rules and not the Thai authorities. It’s something to bear in mind if you do not have proof of onward travel from Thailand. It is strongly advised to check your carrier’s policy before departure.