There's not much to it really. It's basically like GLSL sampler2d type.
You can look at it as a handle to a 2d texture, like ID number. It doesn't store any data. It just points to texture data. You supply this id whenever you want to read from texture in the shader. And there are only few functions that read from texture: texture(), textureSize(), textureProj() and texelFetch().
The main one is texture(). It takes as arguments a handle to the texture (that is sampler2d) and UV coordinates in range 0-1 of the texel you want to read. And it returns vec4 with RGBA values from the texture. That's basically it.
uniform sampler2D myTexture;
void fragment(){
vec4 colorFromTexture = texture(myTexture, UV);
}
Of course you need to set this uniform from a script using set_shader_param() method of the material object:
material.set_shader_param("myTexture", textureObject)
You can find some of info in Shading Language reference in Godot docs:
https://docs.godotengine.org/en/stable/tutorials/shading/shading_reference/shading_language.html?highlight=shading%20language