Minerals are a form of crystal resource.
According to Doran Routhe, a famous United Powers League scientist, planetary systems beyond Sol could contain new resources that could benefit a resource-depleted Earth. Although the terran colonists went beyond their intended destination, Routhe's theories were proven correct. The Koprulu Sector featured rich deposits of crystal-minerals, often found in clusters and sometimes as veins of ore in mountains and asteroids. Other deposits, located under regolith, were detected by means of resonators. Minerals are also found within asteroids/comets in the Sigma Quadrant. Deposits of minerals can disrupt satellite imaging and radar.
Terrans and protoss melt these minerals down to create the armored hulls of starships, vehicles and personal armor. Even the zerg require minerals to harden their carapaces and develop strong teeth.
Extracting minerals takes time and the specialized equipment or anatomy found on SCVs, probes and drones. However, terrans have also developed automated extraction processes to harvest minerals found as ore veins in mountains, using mineral strippers to tear the crystals out of the ground. 
During the era of the Terran Dominion, the Geological Procurement Services division was assigned with finding and exploiting mineral outcroppings for the Terran Dominion. The Dominion considered the acquisition of minerals to be the top priority of the Dominion Armed Forces, and vied for a strategy of keeping them out of the hands of their enemies no matter the cost.
In most melee games, each player starts with 50 minerals, which is the cost of a worker. Usually, the starting stock is spent in training a new worker. Though it is not universal, a typical mineral patch consists of eight mineral deposits with 1500 units of minerals each. Mineral fields grow smaller as workers mine from them, eventually vanishing entirely. Only one worker may mine from a mineral field at a time. When a worker is assigned to harvest from a patch of minerals, if the current mineral field is occupied by another worker the worker automatically moves to an unoccupied field and mines there. If there are no unoccupied mineral fields, the worker will wait until one becomes unoccupied and begins mining there. When a mineral patch is entirely exhausted, the workers cease mining and remain scattered at the former site of the patch until given new orders.
In StarCraft, workers mine 8 minerals per trip. Minerals are the more important of the two physical resources, for all units produced from buildings require at least some minerals to be produced, while more basic units and structures do not require vespene gas. In addition, gas harvesting is possible only by building a gas-extracting structure on a geyser (extractor for zerg, refinery for terrans and assimilator for protoss), which costs 50 minerals for the zerg (100 total if counting the drone required to mutate into the extractor) and 100 minerals for the other races, and sending workers that consume minerals to harvest gas.
In StarCraft II, workers collect 5 minerals per trip but mine more efficiently than in StarCraft due to improved AI pathing and shorter time to harvest a mineral field.
This results in a total pickup rate that is very similar to what it was in StarCraft. Workers can now be set to rally to a mineral patch, causing them to automatically mine from the patch when they finish building.
MULEs can harvest minerals more quickly than other worker units, taking in 25 minerals per trip. They are also able to harvest minerals from the same field as an SCV.
Mineral resource pallets may be found in the campaigns.
Rich minerals were introduced in StarCraft II. They provide 7 minerals per trip when mined from instead of 5. Expansion spots with rich minerals generally only have 6 mineral patches rather than the usual 8. They always contain the same amount of minerals as a regular mineral patch; hence, they are mined faster for the same yield. Despite their description, they take just as long to mine from per trip than a regular mineral patch.
The following section contains information from a previous version of StarCraft II which is no longer valid.
In a 2006 build of StarCraft II, individual red mineral fields can be seen in the center of the map.
Rich minerals were originally called "high yield minerals" and were a brighter yellow color.
In July 2007, rich mineral fields yielded 12 minerals per trip while blue fields still yielded 8. By June 2008, blue fields were brought down to 5 per trip but could be harvested from a little quicker. In August, this was temporarily increased to 6 per trip.
During development of Heart of the Swarm, the oracle's Entomb ability used to prevent minerals from being accessed for approximately one minute, crippling an enemy's economy. The mineral clusters were surrounded by shells, which could be attacked, breaking the shells.
In Legacy of the Void, mineral patches were partially reduced. Of every patch, half of them hold a total of 1800 minerals (formerly 1500). The other half hold 900. Blizzard initially planned to reduce mineral field sizes from 1500 to 1000 to encourage more expansions. During development, half of the mineral fields were reduced to 750, before being raised to 900. The reduction in mineral patches was designed to reduce overly-defensive playstyles.