First, make sure you have the console enabled.
If you're unsure, check the FAQ titled "How do I enable the console in TF2?"
Find the server you wish to join in your server browser, and "View Server Info" on it.
Copy the IP address of the server from the game info window.
Open the console, and type the command "connect <ip>", where <ip> is the IP address you copied.
Start by opening up the settings dialog in TF2.
From there, go to the keyboard tab, and click on the button labeled "Advanced...".
In the advanced dialog, ensure "Enable developer console" is checked, and press "OK".