AI assists in portfolio optimization by identifying portfolios that align with an investor's risk tolerance and specific timeframes. It maximizes returns relative to risk through data-driven analysis.