In its original statement, Hilbert's 17th problem is the problem whether a nonnegative polynomial on \(\mathbb{R}^n\) is a sum of squares of rational functions. Given a ring of real valued functions on some topological space \(X\) we can ask a similar question: which functions can be written as a sum of squares in the total ring of fractions of \(R\), and if so, how many squares are needed? We will be mostly interested in the second part, namely computation of the Pythagoras numbers. For a commutative ring \(R\) with identity, we define \(p_{2d}(R)\), \(2d\)-Pythagoras number of \(R\), as the smallest positive integer \(g\) such that any sum of \(2d\)th powers can be written as a sum of at most \(g\) \(2d\)th powers. If such number does not exist, we define \(p_{2d}(R)=\infty\). During the talk, I will present both classical and new results concerning sums of even powers in rings of polynomials over a formally real field, rings of \(k\)-regulous functions, rings of regular functions on a nonsingular rational surface. Also, the notion of a bad set of a nonnegative function will be discussed. Presentation will be based on: