Go: How is a "suicidal" move that captures enemy stones handled?
This is confusing to many new players. The rule is:


Always capture opponent stones first. That means all opponent groups which are without liberties.
Then, and only then, see if your own stone, or more precisely the group it belongs to, is without liberties


If (after capturing) your own stone is without liberties, the result depends on the rule set used:


In Japanese and Chinese rules, your move was simply illegal. So don't do this!
In New Zealand rules, your own stone (group) now gets captured.


For the second point, you may be wondering why one would ever intentionally play a stone that is immediately taken from the board. The simple answer is that this can sometimes be a ko threat. It can rarely also influence a semeai (capturing race).

There are a few details when performing suicide of a single stone regarding ko/superko, but you would likely never encounter it in practice.