Caveat: This analysis discusses typically and obvious reasons that there might be an agreement as to costs. But, we have know way of knowing the actual reason in particular cases.
In Vancouver (City) v. Ward, 2010 SCC 27, there were three claims in the underlying lawsuit. One was an award of $5,000 for wrongful imprisonment that was undisputed. One was an award of $5,000 for a wrongful strip search which was appealed but ultimately was affirmed. One was an award of $100 for claims related to seizure of a car, which was reversed on appeal.
The appeal decided by the Canadian Supreme Court was an appeal from a direct appeal to an intermediate appellate court. So, no further legal record had to be prepared at that stage of the litigation (with potentially expensive transcription fees), so the only issue as to costs that was outstanding were the costs for the final appeal, which would have been modest out of pocket, although, of course, attorneys were involved. And, even the legal arguments had already been made once by both sides in intermediate appellate court briefing.
Even if the trial court plaintiff had lost both parts of the appeal brought by the government, he would have been a prevailing party in the litigation as a whole based upon his wrongful imprisonment damage award.
But, when you have several claims, some of which go for one party and some of which go for another, there is room for debate over who really prevailed.
Under the circumstances, given the comparatively small amount of dollars at stake, the parties may have simply agreed on a costs resolution (which probably awarded the trial court plaintiff all or most of his costs) to avoid spending more on litigation over how costs are awarded (and equally important, to avoid spending precious words in an Canadian Supreme Court appellate brief arguing that small dollar side issue).
I've entered into similar agreements in appeals of complicated cases in the U.S. for the same reasons.
I don't know if Canadian practice is to file a stipulation of record regarding costs in the trial court, or to simply note in the trial court record or an appellate brief that there is an agreement that has been reached, with a signed copy sitting in each side's files.
Another possibility is that at the outset of the case, or after an initial mediation, there was an agreement reached about costs (perhaps with both sides waiving a claim to costs) as part of a global agreement regarding procedural matters like limiting the scope of the claims to be pursued, dismissing secondary parties from the suit, or stipulating to key facts and/or to the admissibility of key documents to streamline a trial.
Vancouver may well have been motivated in part by appearances. Also, at least in U.S. practice, court filing fees are waived for governmental entities, and neither the lawyers nor the police witnesses give rise to any meaningful marginal cost particular to this lawsuit since the government lawyers and police are both salaried employees of the government, even though the legal fees of the government lawyers are probably recoverable in the proper case. So, waiving a right to collect costs may have been a very minor economic concession to it.
Vancouver also has a great strategic interest in having the case resolved in a precedent making case that can guide its future policies and practices going forward in a situation like is likely to recur, so they have some interest in having the trial court Plaintiff go the distance all of the way to the Canadian Supreme Court to resolve the legal issue the case presented. So, there are all sorts of reasons that Vancouver, in a case involving a recurring type issue presented to a governmental entity might want to reach an agreement on costs and would not merely be focused on maximizing its outcome in the particular case.
Also, while we don't know for sure, it is doubtful that the trial court Plaintiff was personally paying out of pocket to litigate to the Canadian Supreme Court over a $5,100 damages award. Probably some NGO or lawyer with a strategic interest in establishing the precedent financed most of the costs in practice. So, neither side economically felt much of the costs in this case making it an easier issue to negotiate.
But, in Delta Air Lines Inc. v. Lukács, 2018 SCC 2, and Cavendish Square Holding BV v Talal El Makdessi (Rev 3)  UKSC 67, which don't involve governmental entities, concerns about public image or a paramount desire to make precedents to guide future transactions of one of the parties are not nearly so great.
In those cases, a cost-benefit analysis in the individual case about the amount of costs at issue v. the amount of money that could be spent fighting over costs is probably more likely to be the main factor, particularly if the cases are complex enough that the amount of work necessary to fully litigate the costs issue could be significant.