Ship navigators were able to estimate their position by tracking their route using compass headings and speeds, starting from a previous known position. When the Sun or stars were visible, they were able to determine their actual longitude and latitude. The ship's chronometer had been invented, which gave them accurate time to use in their navigation calculations. So, after Titanic hit the iceberg, they transmitted their position, as best they knew it.
As rescue ships approached, they searched the general area. The searchers were aware the location sent might have some amount of inaccuracy. They also were aware survivors may have drifted from the location sent with the distress message.
They also sent up flares, a visual signal, to help ships find them.