Banks will allow you to do this. The rental income you would expect from the 2nd unit (if a duplex) can be counted as income even though the 2nd unit is not rented yet.
For your example of a $1M duplex with you living in one unit and assuming you could rent the other unit for $2,500 would go something like this: For simplicities sake let's say you don't have any personal debt (if you do have personal debt then the loan you would end up with will be lower than the $500,000 you mentioned.
The lender will only count 75% of the $2,500 rent as income or $1,875. The taxes and insurance on the rental unit will be around $650 a month ($650 will also be allocated to the unit you occupy, assuming the two units are about the same size). Lenders assume 25% of the gross rental income will go to expenses to operate such as maintenance, repairs, utilities, landscaping, management, and vacancies. If you don't incur any of these expenses then your actual net rental income will be higher than $1,875, but don't count on it. Over the long run you will have expenses to cover and most likely have some vacancies, too.
The $1,875 less the taxes and insurance for the rental unit equals $1,225 net rental income that the lender will you credit for. Annually that's $14,700 or a 2.94% return on the $500,000 allocated the rental unit not including depreciation which would be about $7,000 a year after deducting the land value. That $7K depreciation will be worth about $1,500 in tax savings if you're in the 20% tax bracket and bump up your return to 3.24%. That 's good for San Francisco.
With this scenario you are looking at a down payment of $500,000 plus closing costs and settlement charges. Costs and charges will be $5,000 to $10,000.
Another way to look at it would be the $1,225 net rental income would cover around a $215,000 mortgage. So, instead of earning cash-flow you could finance $715,000 to break-even and have a $285,000 down payment plus costs and charges.
The risks: 1) San Francisco has rent control laws that favor tenants not the landlord 2) the rent may not be $2,500 3) if you cannot rent for 30 days that's means no income for that time. Alternatives: 1) pay less in an area not in SF 2) get a single family and rent to a roommate or two 3) just get a home for yourself and forget about the rental aspect.
So much of what you can do depends on how much cash you are willing to invest. I specialize in investment property so if you would like to talk, call me at 415 695-0254.