Q:

How do you know what equipment code to put on a flight plan?

Every time I have flown and filed flight plans the CFI or the person I have rented the plane from has told me what equipment code to put on the flight plan. I am curious how you would figure out on your own. Is it in the POH?

A:

Basically you know what equipment is installed on the aircraft (and in working order), and that's what you enter on the form.
For FAA flight plans, there's a list in the AIM (It's table 5-1-3).
Generally for domestic flight plans you file the "best" equipment you have onboard in working order.
FAA "Domestic" flight plans are eventually going away though, and we'll be expected to use the ICAO flight plan format (including its equipment codes).
ICAO equipment codes are a little more complicated because the "Equipment" box lets you list a whole lot more stuff (and the more you enter the more ATC knows in the event of an emergency): Basically you list all the equipment you have in working order under the equipment box on the ICAO flight plan form.
Lists of ICAO equipment codes is available (the one on Wikipedia is pretty complete), and there are handy wizards floating around that let you check boxes and get the string you need to enter on the flight plan.

Look at two hypothetical aircraft, both identical Cessna 172s with different equipment to see how it works:

Aircraft #1 has a VHF Nav/Com (VOR only, no ILS), DME, GPS, and Mode C transponder.
This aircraft would file /G on a domestic flight plan, and DGOV/C on an ICAO flight plan (the ICAO flight plan may also include R and an appropriate PBN code for the GPS capability).
Aircraft #2 has a VHF Nav/Com with ILS capability, and a Mode C transponder.
This aircraft would file /U on a domestic flight plan, and SV/C on an ICAO flight plan.  

Note that the ICAO flight plan gives ATC more information to work with:
If Aircraft #1 calls up and says their GPS died ATC knows they can assign them clearances that use VORs and DME for navigation, but that the aircraft cannot accept an ILS approach at their destination.
Conversely if working off a domestic flight plan ATC will have to ask the pilot what their navigation capabilities are (or they may assume "standard" equipment including an glideslope receiver and ILS capability and offer the pilot an ILS approach only to be told "Unable ILS" by the pilot).

