This is a great question. I don't think it's been researched enough to answer definitively, but I saw a preliminary study out of S Korea that suggests: YES, wearing a mask protects you some, even if not fully. Korean tracers discovered about 10 people got sick from riding a bus on which an infected person sneezed. Half the passengers wore masks, half didn't. All those wearing masks (not N95s) were okay. All who went maskless got infected. Obviously, that's a small study (so small I can no longer find the link!), and results may have been primarily influenced by airflow or length of time on the bus post-sneeze, but it seems likely that the masks helped. I think it's only logical that masks would decrease the liklihood of infection. Any mask will block saliva droplets and prevent you from touching your mouth and nose. They don't make you invincible, of course, but I'll be shocked if it turns out to be true that mask wearing does nothing at all to protect the wearer.
There seems to only be a little bit of research on this question. Here is a link to an article (pre-publication, not yet reviewed) on the subject: https://www.northeastern.edu/envsensorslab/wp-content/uploads/2020/04/FernandezMueller_PreliminaryReportFacemaskTestingProtocol_2020-04-17.pdf (These folks found that having a stretchy outer layer, such as a 10-inch cut slice of pantyhose leg, over your other mask was very helpful.) Another link is: https://smartairfilters.com/en/blog/best-materials-make-diy-face-mask-virus/
I will add a link to the National Public Radio story that summarized some information from the first link I previously posted (study by Mueller & Fernandez) https://www.npr.org/sections/goatsandsoda/2020/04/22/840146830/adding-a-nylon-stocking-layer-could-boost-protection-from-cloth-masks-study-find And also, NPR just posted a brief video with suggestions for helping your home-made mask be a better filter: https://www.npr.org/sections/goatsandsoda/2020/05/13/854428849/video-3-tips-to-make-your-face-mask-more-effective I will comment, though, that as I have started sewing masks, I have noticed some degree of trade-off of breathability versus density of the weave. (My 400-thread-count sateen-weave cotton pillowcase appears unlikely to give me a two-layer mask that I would personally want to wear for any length of time if I had symptoms of nasal congestion.) Since most of us should own more than one mask anyway, I am thinking that I will include a single-layer mask in my own stash, to be worn at those times--I am thinking the single layer would probably still be effective to protect others from me. (Wish I had more data, though.)
Until and unless you know several variables, you simply cannot meaningfully answer this question. So for a non NIOSH certified, legitimate N95 the following.
First, with regard to use in non Covid instances such as air pollution. It provides zero protection from pollutants in the form of gasses or vapors such as ozone, carbon monoxide, and organic vapors. Those require a chemical cartridge respirator that reacts with them when drawn in via inhalation, such as found in a half face "rubber" respirator. So people wearing them in big cities get zero protection from those contaminants. They probably get some protection from particulate pollution, but most likely those of largest size.
Particulates MAY be filtered out but some form of media or membrane. Air, when inhaled, will always preferentially and disproportionately seek to flow where there is less resistance to its flow. So we have two factors:1) leaks and 2)permeability (of an unknown media/fabric that a mask is made of. Or if known, its rate of penetration by various particle sizes.
If your mask leaks, and they ALL do unless they are designed as a close-fitting respirator (not a thing you put on your face and call a "mask"), you are getting completely unfiltered air. What percentage of your inhaled air is unfiltered? Very hard to say. Its anybodies guess for a given fit/person, but it is never close to 0%, guaranteed. I would guess that between 20 and 80% (very wide range of masks/variables out there) is bypassing the media/fabric as pure "leakage". Some masks use materials that are so dense, it promotes bypass. One fake KN95 I have is like that.
Now permeability or, how much of what size particles flow right on thru the media/ fabric upon inhalation?... and how much is trapped. The air that is not leaked or bypassing the media/fabric will pass thru the media/ fabric; the question is what is it's average pore size/porosity and what is the nature and range of diameters of aerosols in that airstream? Add to this the increase in moisture building up in/on a fabric (with no exhalation valve), which may increase resistance/reduce porosity, and your back to incrementally increasing bypass
Your fabric might be like a chain link fence, it might be hardware cloth (look it up), or it might be screen (as on a window in a home), or a reverse osmosis membrane (look it up). A wide range of "hole sizes". The aerosolized particles might be baseballs, ping pong balls, marbles, grains of sand, or grains of talc (sizem not weight reference).
Mix and match these and you see the problem with answering these questions.
One follow-up here: there is soooo much discussion on what kind of fabric and layering as to what makes a good mask. As mentioned above, bypass means it doesn't matter at all what the fabric/material is. Bypass, i.e., going around, not thru the fabric, happens alot more than you think. Nose, chinline, jawline, cheek contours, pleats, slack areas...these all leak air, very preferentially to going thru the resistance of fabrics.
OTOH, if you physically distance, outdoors, you really don't have to worry much about your mask in the first place. You are not going to get the virus from 10' away, outdoors, or from a 1-2 second period of proximity to someone walking nearby. It just doesn't work that way. If it did, everyone in the soupermarket would HAVE to have been infected. That air is a soup of exhalations, of everyone else shopping, in comparison.