Well the AR15 to my knowledge is just a civilian version of the M16. The M4 is a shortened carbine of the M16...but there is no MG or sniper variation to my knowledge from the M16. Nothing in wide use that I know about. Most of the newer rifles are a family of variations from the start like the G36, the XM8 prototypes (canned apparently), Type 95, etc.
Actually, the M4 is a different weapon altogether. M16's chamber a 7.62mm NATO round; the M4 chambers a 5.56mm NATO round. The carbine design is based on the design of the M16, but in terms of its ballistics its quite a different firearm.
The AR15 is the design prototype (AR = assault rifle) for the AR-15 civilian variant, M-16, and M-4 design, but the AR15 is also based off the 5.56mm cartridge as opposed to the 7.62mm. Interestingly, an AR-15 is really nothing more than a high-powered .22 calibre semiautomatic rifle; 5.56mm NATO rounds are merely steel-jacketed .22 calibre rounds with extended powder capacity; the next evolution of the .22LR ammunition type. They travel faster and farther than a .22LR round, but the actual diameter is nearly identical.
The G36 family consists primary of the G36 (long rifle), G36K (carbine), and G36C (Commado; short-barelled CQB weapon based loosely off the H&K's UMP design). Like the M16 family, the long rifle chambers 7.62mm ammunition while the shorter carbine and commando variants are 5.56mm.