Gibraltar is a British overseas territory. It is located in the south of Spain. Its not part of the Schengen Area or the European Customs Union. If you're not from the EU, you might need a Gibraltar visa as the entry requirements for Gibraltar are not the same as the United Kingdom.
Go to the border and just stand somewhere nearby; cars will be moving slowly. Be careful not to hitchhike too close to the border as there are many Guardia Civil (police formed by Franco) and they are not really kind to hitchhikers.
Try hitching at Europa Point! There are many tourists who are at least driving you back to the city centre. We got lucky and got a hitch further to Tarifa with the first car we asked!
Hitchhiking a boat
If you're trying to hitch a sailboat to the Canary Islands / Morocco or further to the Caribbean, go to the marina in La Línea. It's way better than the one in Gibraltar, as most travelling sailors are stopping in La Línea, in Gibraltar you have mostly residents.
Do not forget to buy everything that you need in La Linea, because food is 2-4 times more expensive in Gibraltar than in La Linea. There is a lot of big supermarkets and some of them works 24 hours, for example Carrefour (Avenida de la Colonia).
Cigarettes, tobacco and strong alcohol is cheaper in Gibraltar than in other Sсhengen countries, because taxes is very small.
Nazareth House is a kitchen for the poor where you get coffee and food from Monday til Friday 10-12. You can also take a shower and borrow a book.
Warmroads Short analyses of hitchhiking in Gibraltar - warmroads
Tarifa - Cool vibe nomad town a few miles south of Gibraltar
Sometimes Ocean Nomads meet-ups are being organized in Tarifa to share tips and stories on boat hitchhiking, sailing and sustainability.
Nomadwiki & Trashwiki