Think of it like this...
"A well regulated militia, being necessary to the security of a free state, the right of the people to keep and bear arms shall not be infringed."
The first part, "A well regulated militia, being necessary to the security of a free state" is the preamble. It states the purpose of what is about to come after it. In historical context, a militia was a civilian military made up of all able bodied men from all walks of life. These were not professional soldiers, they were the average Joe blacksmith, farmer, gunsmith, etc etc. Being well-regulated meant that they practiced regularly and were established at some level... for example, you could be in a militia that meets and practices on the weekends, back then it was usually required. Militias like these were common in those times since they were necessary for protection from bandits, Indian attacks, and eventually fighting against tyranny. Militias might have even been called upon by the local government (at the town or state level perhaps) to fend off invaders, or to help with disaster relief/recovery. Even today, this is still possible, but the state now has the National Guard, however, the National Guard isn't the same as a militia since it is no longer a civilian military. In modern terms, the National Guard is considered the "organized militia" whereas the civilian militia is considered the "unorganized militia". The Unorganized militia may still be called upon as reserves, but they are for all intents and purposes, independent of the state unlike the National Guard, which is state funded and state organized. That right there, is very important to remember when distinguishing the two.
Another part that needs to be hashed out in historical context is the meaning of the word, "state". A state in those times refers to a body of government, or civil authority. England was a state, France was a state... each of the thirteen original states were meant to be on this same level of distinction, bound together loosely for mutual protection and prosperity. The fact that they said "free state" is important since it describes the condition of the state... free. It is safe to say then, ignoring everything else they said that would back this next statement up, that they had defense against tyrannical government in mind when they wrote this Amendment. This is why they saw fit to distinguish that it is a militia which is necessary to the security of a free state, rather than a standing army such as the National Guard, the Army, Marines, Navy, Air Force, and Coast Guard.
The second part, is telling the reader how the first part will be accomplished. Since we've established that a militia is made up of armed civilians, it would make sense that in order for them to be able to perform their role in said militia, they would need to have their own weapon in order to participate. Therefore, the state should not be capable of making any sort of law prohibiting, or restricting the people from the ability to keep and bear arms. It is also important to note that they do not mention what kind of arms the people are allowed to have. The reason for this is that the founders knew that technology is always improving, and that the people should never be restricted to using arms that are inferior to any sort of invading force, standing army, or tyrannical government.
Another way of writing this amendment that spells it out...
"A well armed, and trained citizen military that is independent of the state, is necessary for protection, and the maintenance of liberty within a sovereign nation, therefore the ability of citizens to own and maintain their own firearms so that they may participate, shall not be restricted or prohibited in any way, shape or form."
Taking all of this into consideration, it's pretty clear that Thomas Jefferson was a man of his word when he said, "The most valuable of all talents is never using two words when one will do". Though it was officially written by James Madison, Thomas Jefferson was surely an enormous influence since he was in constant contact with Madison from Europe during the Constitutional Convention. In only twenty seven very carefully chosen words, they said a lot.
Hope this Helps!