Hi Olicombet,
Foreigners are allowed 3 month visas, or a maximum stay of 180 days per year.
If you wish to apply for a permanent visa, one of the following conditions must be met:
1. You are married to a Brazilian.
2. You have a child with a Brazilian.
3. You invest 250.000 US Dollars or Euros in Brazil.
4. You have reached the age of retirement (50 years) with a pension.
There are various other visas required if you are to work in Brazil.
You will need to apply to your nearest Embassy.