When should I use &nbsp in HTML, and how is it different from regular spaces?

I often see &nbsp used in HTML, and I understand it creates some whitespace, but I’m not exactly sure how it works or when it’s appropriate to use it.

Is &nbsp just a non-breaking space, or does it serve another purpose? In what scenarios is using &nbsp better than a regular space, for example, in layout, formatting, or preventing line breaks?

Would appreciate some examples or best practices for using   effectively in HTML.