Paul White explains how and when lock escalation is triggered in SQL Server, clarifying misleading information you may have seen in official documentation and other sources.
There is a very common anti-pattern you should avoid, involving updating a row if it exists and inserting it if it doesn't. See how to avoid race conditions and deadlocks.