I am US citizen and professional software consultant. If I get a contract position, lets say in the UK or Switzerland for a European company, do I pay taxes to that country, or to IRS? Does it matter if the company I work for in Europe is a US company with a branch in Europe?
If you are working in Europe you will owe income taxes to the country you are living in and to the IRS. Unlike most countries in the world the US citizens pay taxes on income they earn anywhere in the world. There is the foreign income tax exclusion which applies to the first $92,900 earned abroad and you can generally get credit for taxes paid to the country you are living in.
If you are living in the US and telecommute for a job in Europe your tax situation would be the same as any other 1099 contractor except the European company may or may not issue you a 1099 at the end of the year. You would still need to report the income from the contract whether or not you received a 1099.
If you are out of the U.S. for "one year" (330 or more days out of any 365 day period), the first $70,000 or $80,000 is exempt from U.S. taxes. (It was $70,000 when I did this in the 1990s, but it has risen since then.) Under these circumstances, you will have to pay taxes in the host country. You may or may not get a deduction against your further U.S. taxes, depending the tax treaties between the two countries.
If you a "travelling," and in the host country for a "short" period of time, then you don't pay taxes to the host country. Rules vary, there might a limit of 60 or 90 days spent in the host country before you are liable for taxes. There was also the case where someone spent the better part of the year in a host country, but was careful to leave at 89-day intervals.
There might be other circumstances the govern your tax liability. For instance, you might not be liable to the host country for taxes if you stayed in a hotel (temporary quarters) but might be if you rented a house or apartment ("permanent"). Living in "company housing" might be an intermediate case, subject to local rules.