You start shooting automatically when an enemy enters the attack area (the cone of red light from your weapon). The attack area depends on the weapon of your hero.
Walls and objects stop the bullets unless your weapon allows shooting through the walls. Obstacles such as crates and doorways allow shooting from cover if you peek out just enough for the enemy to be in your attack area.
When you move, your aiming is worse. Moving widens your attack area, and your shots may miss their goal. Stop to aim better, and your shots will become more precise.
Shooting is loud, and other players nearby can hear it. They can also see the bullet trajectories if they are close and Shooting icons in the direction of the shooting if they are far away. Take this into account if you don't want your location to be known!