To figure out how many units a jurisdiction must meet, the State looks at several factors - existing jobs, population growth, socio-economic population data, commute, new jobs, existing housing, housing needs, etc.
After evaluating this data, the State assigns the region (the Bay Area), a number called the Regional Housing Needs Allocation or RHNA (pronounced 'ree-nah'). It is then up to the region, in the Town's case - the Association of Bay Area Governments (ABAG) to decide how much each jurisdiction is responsible for based on their size and projections for growth (Plan Bay Area). This cycle, all jurisdictions have a higher target than in the past. More details about RHNA are available here. All jurisdictions must adopt a plan that meets or exceeds the allocation.