In most contexts, when you start casting
It's very understandable that this question came up. The past and present tense of "cast" are the same (at least since the 1500s), so it's grammatically ambiguous whether the word "cast" refers to the activity of starting or finishing the spell. Fortunately, there is a fairly reliable answer. While specifics may vary depending on context, in most cases when timing is important you "cast" a spell the instant you start casting it. This is especially important (and evident) in the case of Concentration spells.
The text on conditions that end Concentration states (PHB, p. 203, bold added):
You lose concentration on a spell if you cast another spell that requires concentration.
And there is an official clarification on Concentration in Xanathar's Guide to Everything's introduction (thanks to Rubiksmoose for pointing this out) which states:
As soon as you start casting a spell or using a special ability that requires concentration, your concentration on another effect ends instantly.
This timing is essential to the nature of concentration. After all, if you permit a Concentration spell to be active until the other concentration spell is finished casting, then the (optional) rules on simultaneous effects (XGtE p. 77) would mean that in most situations, the spellcaster would chose whether the end of one spell or the start of the other came first. This would permit a spellcaster to have two Concentration spells active at the same (instantaneous) time, which kind of defeats the purpose of Concentration.
This can also be seen in other contexts where "cast" is used, such as the rules on Longer Casting Times (PHB p. 202, bold added):
When you cast a spell with a casting time longer than a single action or reaction, you must spend your action each turn casting the spell...
This text would make no sense if it applied only after the spell was completed, since it applies to the actions necessary while casting the spell.
This is a General Rule
There's an ambiguous case that can help clarify this rule: the rules on Spell Slots state (in various places, e.g. PHB p. 58):
To cast one of [your]... spells, you must expend a slot of the spell’s level or higher.
It's unclear from this wording whether you need to spend a spell slot at the start of casting a spell or the completion. Whichever is meant here, it will be a general rule that will have exceptions when other rules specifically contradict it.
I maintain that the "general rule" is that you spend a spell slot right when you begin casting a spell, unless some game feature says otherwise. This rule is backed up by some unofficial rulings by Jeremy Crawford. For example, it doesn't state in the rules whether you need to spend a spell slot to Ready a spell, but you do. Similarly, the general rule can be seen in the fact that a countered spell still costs a spell slot, in spite of the fact that Counterspell interrupts the spell.
The idea that this is a "general rule" is also seen in the fact that there is an explicitly spelled out "exception to the rule" in the section on Longer Casting Times (PHB p. 202, bold added):
you must maintain your concentration while you [cast this spell]... If your concentration is broken, the spell fails, but you don’t expend a spell slot. If you want to try casting the spell again, you must start over.
This exception shows that in the case of Spells With Longer Casting Times (longer than an Action), you don't expend a spell slot with the usual timing. If a spell slot was typically spent at the end of the casting of a spell, they would not have needed to spell out this exception, because it would have been part of the general rule.
There are Exceptions
There are definitely exceptions to the general idea that "cast" refers to the start of casting a spell. For example, int he spell Find Familiar, it states (PHB, p. 240, bold added)
When the familiar drops to 0 hit points, it disappears, leaving behind no physical form. It reappears after you cast this spell again.
Note that Find Familiar has a casting time of 1 hour. Naturally, this couldn't mean that the familiar will appear again immediately after you begin casting the spell: or else spellcasters would stop their hour long casting as soon as they had their familiar back again (technically, the "after" in the spells description gives some leeway, but it's fairly clear they meant "after the spell finishes casting").
A DM could rule in any ambiguous situation that "cast" means beginning to cast, continuing to cast, or finishing casting. In the case of Simulacrum, for example, the 12 hour casting time might make a DM more inclined to keep the duplicate in place during the casting if they wanted something to try to dramatically stop the caster from completing this spell, and thus decide that the duplicate was still active during the casting (to make the subsequent combat more interesting for the caster's player, who otherwise would do nothing other than saying "I keep casting the spell" for the whole thing).
The usual role in the rules for spells whose effects end "if you cast this spell again" is to ensure that the effects of this spell are never overlap with subsequent castings: and that intent is maintained if the spell ends either at the beginning or the end of the casting. A DM will have to make a call in some ambiguous cases which meaning of "cast" applies.
However, to keep things consistent, and to maintain the functionality of Concentration, the general rule (to which there are exceptions) is that spells are "cast" when you start casting them.