If all living things like animals require oxygen to live, how can people think that there could be life on other planets such as mars for example ? Living things require oxygen and carbon dioxide, and these planets do not have plants and such to provide this. So why do scientists try to still look for life on these planets ?
TL;DR: Not all life requires atmospheric oxygen or carbon dioxide. There are many organisms here on Earth that use chemosynthesis to process chemicals like methane or hydrogen sulphide for energy.
The search for life on Mars has concentrated on finding evidence of autotrophic microorganisms – organisms that convert simple chemicals in the environment into complex organic compounds. Most autotrophs use water as the reducing agent, but some can use other chemicals like hydrogen sulphide.
The energy source for these autotrophs can either be sunlight, in which case we call them phototrophs (which includes algae and green plants here on Earth), or obtained through the oxidation of electron donors in their environment, in which case they're called chemotrophs.
There's a wide variety of chemotrophs here on Earth, typically living in completely dark and often hostile environments such as next to deep-sea volcanic vents. For example, iron-oxidizing bacteria even colonise new lava beds in the deep ocean, and in effect use the oxidation of available ferrous iron as their respiratory process.
There's no reason to think that autotrophs couldn't find niche environments on Mars in which to exist, but the biggest hurdles are the significantly lower temperature and pressure, and the significantly greater radiation. The latter can be overcome by colonising sub-surface environments, which eliminates the phototrophs from contention. While UV radiation penetrates soils only in the millimetre range, one study found that viable dormant cells would have to be at least 7.5m below the planet's surface to survive the cumulative damage from cosmic radiation.
What's more, in addition to finding potential evidence for life now, there is also the equally important possibility of past life that has gone extinct but left biosignatures like fossils or other geological byproducts. It is important to realize that there is considerable evidence that the Martian climate used to be very different, and there may have been a much denser atmosphere, providing the carbon dioxide that plant life would need to live on the surface and use photosynthesis. The fact that there is not a lot of oxygen in the atmosphere now suggests that there was not a multibillion year history of plant life like the Earth has (a lot of it without much oxygen), but there could have been a short period where life did thrive, and it might be hard to tell now that this ever happened-- without looking closely. But yes, it does seem likely that there are places in the galaxy more conducive to life than Mars, Mars is just the closest-- and you always start looking for your lost keys under the streetlights, going on only after you've eliminated that possibility.