Every bicycle I have seen in my life has its gears and chain on the right side? Why is this? The only thing I could find regarding this question is this forum topic, which speculates about things such as the prevalence of right-handed people, the idea that it is easier to produce right-handed threads since they are more common, and the traditions of mounting a horse, but I couldn't find anything definite. Does anyone here have any idea?
Because (most) people are right handed.
Right side drivetrains are rooted in the fact that rotating clockwise causes bolts, etc. to tighten—this dates back to the first "safety bicycles" introduced in the 19th century. With the drivetrain on the right, more (standard threaded) parts will be rotating clockwise and thus tightening themselves as the rider pedals.
Drivetrains are on the right today because that's what bicycle builders decided to do in the late 1800s. As to why they originally decided to put drivetrains on the right, it's probably because rear cogs used to be screwed on (some still are). Standard threads dictate rear cogs be on the right, so that pedaling force tightens the cogs. (If they were on the left, pedaling force would likely loosen cogs.)
Today, left-hand drivetrains are possible, but more difficult to create because more reverse-threaded parts are needed. Generally, things like pedals and bottom brackets have threads that are reversed/asymmetric on one side. They're made specifically to work when the drivetrain is on the right—tightening themselves as the rider pedals. If these standard parts are placed on a bicycle with a drivetrain on the left, then those same parts will be loosening themselves as the rider rides.
But why do right-turning bolts tighten? Shortly before the safety bicycle was introduced in the 19th century, the right-turning convention was adopted because it's better to have all bolts work the same way and it's easier to turn them with your right hand. And most people are right handed.
It is a little known fact that the Wright Brothers invented the left-hand thread for the left-hand pedal in 1900. Therefore, up until then it is highly unlikely that bicycles used any left-hand threads on them at all. Therefore, as noted by @Eric Silva the chainset could have been on the right because that is the simplest way for the sprocket to have been bolted on.
Nowadays we take threaded nuts and bolts for granted, however, it has been a long journey of understanding to get threaded connectors standardised and working as well as they do now. Steel on steel threaded connectors of the past were far from reliable and far from standardised. Therefore for 'Safety Bicycle 1' there would have been no problem to have made a track-bike style locknut or a left-hand thread to secure the sprocket if it was felt that it was needed to place the chainset on the left.
As noted by @onestop the safety bicycle, like all the best inventions of that period, was a British design. It was designed for riding on the left with roads that did have pavements (sidewalks) and kerbs. Mounting and dismounting the bike from the kerb, pushing the bike and parking the bike with a pedal on the kerb works out a lot better with the chainset on the right (if you are in a country that 'drives' on the correct left-side of the road). Clothing gets to stay cleaner and that would have been a huge benefit in Victorian Britain when front-loading automatic washing machines weren't exactly commonplace. These are lucky benefits and probably were not uppermost considerations in the design of 'Safety Bicycle 1'.
Placing the gears away from the kerb-side of the bike made a lot of sense in the days before cars took over when you could park your bike with it being supported by a pedal on the kerb. Doing so with the kerb on the left means that you are unlikely to damage the chainset or derailleur particularly if the bike falls over. Up until the 1980's this was the proper way to park a bicycle (if my memories of Cycling Proficiency Test serve me correctly).
As for pushing the bicycle and how that works out better if the bike is on the right hand side, this works out better in countries that drive on the left for all the reasons @onestop cited and more.
According to the Highway Code you are supposed to walk a bicycle on the right, facing on-coming traffic, not on the left with traffic coming from where you cannot see. With narrow pavements as found on country lanes you can push the bike with the bike on your right controlled by your (for 90% of the population) stronger right hand, the bike on the pavement with yourself on the road. When on-coming traffic comes along it is relatively easy to step up onto the pavement to clear the road for the on-coming car(s) and you don't have to drag the bike up and down the kerb.
Like @onestop I also do the turning around thing when leaning the bike against a left-side wall - glad I am not the only one with this quirk.
All considered, although the chainset on the right works out best for countries that drive on the left for a whole host of reasons, it was probably the lack of left-hand threads in bicycle design that was the deciding factor. And, your little gem of 'I did not know that' for today is that the Wright Brothers invented the left-hand thread left-pedal.
Why did early manufacturers of safety bicycles put the drivetrain on the right? I have no evidence for this, but it's always struck me that a large part of the reason is surely that the safety bicycle originated in a country where you drive on the left.
When you're pushing your bicycle, or mounting or dismounting it, you're less likely to get chain oil on your clothing if you stand on the side away from the drivetrain. But it also seems sensible to walk or stand on the footway (sidewalk) and hold the bicycle in the road (note the same principle applies even when there's no footway - you want to stand away from passing traffic). Hence in a country where you drive on the left, it makes sense to stand on the left of the bicycle and therefore the drivetrain should be on the right.
I've found that one secret to avoiding getting oil on my trousers is always to stand to the left of my bicycle when pushing, mounting and dismounting, and always to park it with the right (drivetrain) side against the wall or stand. This even means that when I stop on the left side of the road and lean it against a wall to my left, I turn it around first. But it becomes difficult to keep to this rule when I cycle in countries where they drive on the right - i'd be standing in the road when mounting or dismounting.