Doesn't talking about suicide encourage it?

It depends what aspect you talk about.

Talking about the feelings surrounding suicide promotes understanding and can greatly reduce the immediate distress of a suicidal person. In particular, it is OK to ask someone if they are considering suicide, if you suspect that they are not coping. If they are feeling suicidal, it can come as a great relief to see that someone else has some insight into how they feel.

This can be a difficult question to ask, so here are some possible approaches:

"Are you feeling so bad that you're considering suicide?"
"That sounds like an awful lot for one person to take; has it made you think about killing yourself to escape?"
"Has all that pain you're going through made you think about hurting yourself?"
"Have you ever felt like just throwing it all away?"

The most appropriate way to raise the subject will differ according to the situation, and what the people involved feel comfortable with.

It's also important to take the persons overall response into consideration when interpreting their answer, since a person in distress may initially say "no", even if they mean "yes". A person who isn't feeling suicidal will usually be able to give a comfortable "no" answer, and will often continue by talking about a specific reason they have for living.

It can also be helpful to ask what they would do if they ever were in a situation where they were seriously considering killing themselves, in case they become suicidal at some point in the future, or they are suicidal but don't initially feel comfortable about telling you.

Talking exclusively about how to commit suicide can give ideas to people who feel suicidal, but haven't thought about how they'd do it yet. Media reports that concentrate solely on the method used and ignore the emotional backdrop behind it can tend to encourage copy-cat suicides.