Humankind will never totally grow out of the need for warfare, or so military sci-fi would have us believe. There will always be some foe to fight and humanity's best and brightest will always be required to suit up and enlist for the cause.
Military sci-fi often serves as a metaphor for a modern-day conflict. The Sci-Fi Channel's series "Battlestar Galactica," for example represents the current "war on terror" and conflict in Iraq. Robert Heinlein's "Starship Troopers" appears, on first glance, to be about a young man enlisting to fight extraterrestrials who have attacked Earth, but it was really written in support of the U.S. nuclear testing program of the 1950s and '60s.
Military Sci-Fi stories usually have the following themes in common:
The conflict --- The conflict is generally assumed to be inevitable; there will be no giving peace a chance. The conflict is often between humans and aliens, democracies and dictatorships, etc., and the military approach is the only option available. Or so it seems. Many works of military sci-fi end with the characters realizing that the conflict was pointless.
The military -- Traditional military values (discipline, courage, etc.) are usually stressed.
The hero – The story is often told from the point of view of either a soldier or officer. Oftentimes, he or she is a reluctant draftee, recruited as cannon fodder or because of some special ability vital to the war effort. Sometimes the hero has been especially created for the fight. This kind of hero often wonders why he is bothering to fight a war for a society he is not part of.
Technology -- Tech is generally advanced and often described in detail. However, in some stories technology is fairly static, in some cases using weapons that would be familiar to present-day soldiers. Nevertheless, the wars are not generally won by fancy weapons or logistics. They are won by people, with willpower and military virtues.
Historical References -- Often actual historical battles or conflicts are models for fictional situations. A few such events have been re-used often enough to become clichéd, such as the battle of Rorke's Drift or the Nika riots. Often starships are classified as in the Washington Naval Treaty of 1922: heavy and light cruisers, etc.
Government -- Military sci-fi often takes shots at government, sometimes showing democracies as bloated, inefficient and openly antagonistic to its military protectors and liberals as out-of-touch ivory tower academics. Other sci-fi is written from liberal viewpoints and works like Joe Haldeman's "The Forever War," which indirectly criticizes the military, are not unknown.
Horror and futility -- Warfare is generally not glorified in military sci-fi. Much of it is written, in part, to educate people who have not experienced war, but who might have to make a decision to start or support a war (as policy makers or as voters) about what war is really like, and what the powers and limits of the military as a tool of policy are.
Military Sci-Fi Links:
Military Sci-Fi 101
The good, the bad and the ugly.
You'll be reading "Ender's Game"; here's what I want you to know.
Children throughout history have been called upon to fight their parent's wars.