So, when you configure a layer in Geoserver it s data (most images for the map) are served to you using what s called URL endpoint. It s a link for where the application requests the images (tiles) and creates the map for you. It will be this way, no matter if you are using KML, Shapefiles of Postgis database. The server takes care of it and make the visual information available via that endpoint.
For the web, the most popular is the OpenLayers, witch is a Javascript library that can manage the hard process for you, using simple HTML as it s enviroment.
A good example I ve found of them working together is here.
Note the lines I m hightlighting bellow:
var ccounties = new OpenLayers.Layer.WMS(
"Counties of Colorado - Untiled",
"http://thisawsomesite.com:8080/geoserver/wms",
{
width: 426 ,
srs: EPSG:4269 ,
layers: geosolutions:Counties ,
height: 512 ,
styles: ,
format: image/png **
},
{singleTile: true, ratio: 1}
);
map.addLayer(ccounties);
http://thisawsomesite.com:8080/geoserver/wms -> this is the url of the geoserver server that will give you the tiles. WMS is the service that transforms data into those images.
layers: geosolutions:Counties , -> this informs to geoserver, via the request, that you want the "Counties" layer, from the "geosolutions" workspace. Pretty simple, isn t it?
**styles: -> here you inform the name of the style I ve created.
format: image/png -> This one is the image format (image/png or image/jpeg are the most used, but there are more). Just remember that jpeg is usually smaller, but png is the option for when you need transparency/opacity settings.
srs is the projection. I don t remember of it s need here. The default map projection should take place if this is left.
If you are unsure of how to create an OpenLayers application, Geoserver gives you an example of the layers you have. Go to Layer Preview, in the left menu and click "OpenLayers" to see a simple example. You will notice that there are multiple options to retrieve the information in the menu right beside that link.
Other links you may find usefull:
dev.openlayers.org/releases/OpenLayers-2.13.1/examples/getfeatureinfo-control.html
dev.openlayers.org/releases/OpenLayers-2.13.1/examples/
dev.openlayers.org/apidocs/files/OpenLayers-js.html
I hope this was helpfull. See ya