Legal requirements for riding

Bicycle law is the parts of law that apply to the riding of bicycles. It varies from country to country, but in general, cyclists' right to the road has been enshrined in international law since 1968, with the accession of the Vienna Convention on Road Traffic. Under that treaty, bicycles have the legal status of vehicles, and cyclists enjoy the legal status of vehicle operators. There are over 150 contracting parties to the treaty, including the United States, Canada, Mexico, the United Kingdom, Ireland, almost all of Europe, Australia, New Zealand, Japan, and China. In countries that are contracting parties, the treaty has the force of law, and its provisions have been incorporated into national law.
The position of British cyclists was first established by the Local Government Act in August, 1888. It removed the right of local councils to treat cyclists among the "nuisances" it could ban and defined them as "carriages".
International varieties of bicycle law

Bicycle laws in the Mainland China

Laws may exist, but they are almost universally ignored. When asked, bicyclists in Shenzhen seem only to be aware of the law that makes electric bicycles illegal except for licensed delivery or tradesmen, but nobody worries about it because the cops almost never stop you. The unwritten rules of the road are roughly as follows: Ride on the right, unless there is a truck, car or bike, delivery trike or motorcycle heading toward you on the wrong side of the street. This happens every 2 minutes or so on most city streets. When this happens, ride either on the sidewalk, the middle of the road or on the other side of the road facing traffic. There are seemingly no laws or conventions about which side of the road or sidewalk to ride on. Approximately half of the bicyclists ride the wrong way on one way streets or in the lane reserved for oncoming traffic. The most common practice for turning left on a 2 lane street is do so from the wrong side of the road, against oncoming bike and vehicular traffic, forcing your way around the oncoming cars until you find an opening, then turn left into oncoming traffic and fight your way across onto your own side of the road. The rest of the people use a less predictable approach. Bicycles (and pedestrians) never have the right of way. Motorized vehicles never the yield the right of way unless it is almost certain that the cyclist will be killed. In fact, if a motorist or motorcyclist thinks there is any chance that allowing you to pass would require them to slow down, they will deliberately overtake you and cut you off. On a typical 20 minute commute, this will happen at least 2 or 3 times. There are also no conventions about what to do when two cyclist meet head-on on a sidewalk (where about 70% of cyclists travel). An equal number pass on the right as on the left, with frequent collisions.

Bicycle laws in the United States

For at least the past 60 years, bike safety rules and cycling laws have been drummed into the head of children, such that good cycling habits and etiquette is pretty much ingrained into the minds of the populous. The vast majority of motorized vehicles will automatically give you the right way. Similarly, the vast majority of bicyclists travel on the right hand side of the road, and almost always yield for pedestrians. The few cyclists travelling on sidewalks are mostly children or families with children. Everyone knows that riding on the sidewalk is illegal for an adult, but generally people have enough respect for the law to ride on the right hand side of the sidewalk most of the time, and yield for pedestrians.