Whether one can recover attorneys fees after litigation in California depends upon the nature of the case. Their amount may be affected by the nature of the judgment.
The general rule is each party is responsible for that party's attorney's fees. That means that the trial result is irrelevant - no matter what happens, one pays for one's own attorneys fees.
There are, however, some exceptions:
First: if the parties are litigating a contract, the contract text
itself may provide that the prevailing party can recover attorneys
fees from the non-prevailing party. Such "Attorneys' Fees Clauses"
are common. The prevailing party may have to file a motion in the
trial court for the judge to add attorneys fees to the judgment
amount; the judge will also be responsible (in ruling on the motion)
to determine the amount of attorneys fees.
Second: specific state statutes may allow the prevailing party to
recover "Statutory attorneys fees." This is completely dependent on
whether the case at issue fits the various statutory definitions. For
example, the Song-Beverly Consumer Warranty Act (the California
"Lemon Law") provides for the recovery of attorneys fees by an
aggrieved consumer. There are multiple other examples throughout the
California Codes.
Third: @ohwilleke (to whom thanks) added a comment below that includes other exceptions to the general rule. The comment text was: There are a few other exceptions, e.g. breaches of fiduciary duties involving trust finds, bad faith breaches of insurance contracts, etc. Also, it is possible for attorneys' fees awards to be made because litigation or some specific conduct in litigation is either groundless and frivolous, or violates a court rule. Further, a prevailing party generally gets court costs (e.g. filing fees, expert witness fees, copying costs, and other out of pocket expenses other than attorneys' fees) even when attorneys' fees are not awarded. Most are modest, but not expert witness fees.
If the case at issue does not fall within an exception, the general rule — each party is responsible for their own attorneys fees — applies.