What do the codes mean on airline tickets?

Airline tickets have a single letter code listed as class or status that tells the airline where you're sitting. Among the most common, Y is full-fare economy, T is discounted economy. J is full fare in business class, D is discounted business. Some are universal to all airlines, others are specific to individual carriers. For example if you're flying with Etihad, P means you're headed for one of their Residence suites aboard an Airbus A380. That letter also tells the airline the fare rules that apply to your booking. As well as T, K and L are also discounted economy fares, and each comes with a different set of rules. Among other criteria those fare rules will determine whether you qualify for frequent flyer points, what baggage allowance applies and whether you can make changes to your booking and if so, what the charge will be. 

The reason there are so many different codes is that there are so many different fares. On most flights you can expect  the person in the next seat has not paid the same fare as you even when they're getting on and off at the same two points. Airlines utilise a variable pricing strategy known as yield management which predicts and influences consumer behaviour with the aim of maximising revenue. How far in advance the booking was made, on which day of the week it was booked and length of stay in the case of a return ticket are just some of the factors that influence ticket price.