Most tickets can be bought up to 90 days in advance. Some tickets can be bought only on shorter notice, and some tickets on even longer notice. The cheapest rates get sold first, so you want to be the first to buy the ticket after it becomes available.
Cheap domestic tickets (on any train) are called Sparpreis and exist in domestic and international forms. This is distinct from the Länder-tickets, that are cheap group tickets but do not permit entrance on fast trains (and are thus not practical for intercity travel). You can read more about domestic Sparpreis-tickets here.
Cheap international tickets are called Europa-Spezial and are valid if either starting point or destination is outside Germany (but not both). They exist for all neighbouring countries of Germany and a few further countries (for example, Sparpreis Schweden offers cheap tickets to Sweden). Those are available on limited connections though a special interface. Those tickets are between any station in Germany to a selection of stations abroad (usually those served by direct trains from Germany, or possibly with a single change, but not more). In your case you should be interested in the Europa-Spezial Polen which offers trains between Poland and Germany from €19. For example, booking now for mid-January finds Warszawa–München for €49. See also @neo's comment below to save more money.
Cheap tickets for night trains are available directly through the CityNightLine interface as soon as tickets become available. (Citynightline no longer exists)
Note that, just like for airfares, with cheap tickets you might want to carefully check the flexibility. You might not be able to change or cancel a cheap ticket, or only at considerable cost. However, if you are going to travel a lot in a short time, consider getting a railpass, such as Interrail or Eurail; then you need only the reservations in addition, which are very cheap (a few euro for a day train) and fully refundable.