Which utility function yields a constant price elasticity of demand function? How do I know which utility function I can use to find an isoelastic demand function, e.g., $x(p)=Ap^a$? 
And similarly, which cost function can I use to find an isoelastic supply function?
Does it work through trial and error, or is there a particular method?
By Roy's Identity we have that Marshallian (uncompensated) demand for good $x_i$ is

$$x_i^M = \frac {\partial U^*/\partial p_i}{\partial U^*/\partial B} \tag{1}$$

where $U^*$ is optimized utility over goods vector $\mathbf x = (x_1,...,x_i,...x_n)$ and $B$, which is the available budget, and given the price vector $\mathbf p = (p_1,...,p_i,...,p_n)$. To obtain a constant elasticity demand function we require

$$\eta \equiv \frac {\partial x_i^M}{\partial p_i}\cdot \frac{p_i} {x_i^M}=const. \tag{2}$$

Using $(1)$ we have that 

$$\frac {\partial x_i^M}{\partial p_i} = \frac {(\partial^2 U^*/\partial p^2_i)\cdot(\partial U^*/\partial B) -(\partial^2 U^*/\partial B^2)\cdot (\partial U^*/\partial p_i)}{\big[\partial U^*/\partial B\big]^2} \tag{3}$$

Inserting $(3)$ and $(1)$ into $(2)$ we have 

$$\eta \equiv \frac {(\partial^2 U^*/\partial p^2_i)\cdot(\partial U^*/\partial B) -(\partial^2 U^*/\partial B^2)\cdot (\partial U^*/\partial p_i)}{\big[\partial U^*/\partial B\big]^2}\cdot \frac{p_i} {\frac {\partial U^*/\partial p_i}{\partial U^*/\partial B}}$$

$$= \frac {(\partial^2 U^*/\partial p^2_i)\cdot(\partial U^*/\partial B) -(\partial^2 U^*/\partial B^2)\cdot (\partial U^*/\partial p_i)}{(\partial U^*/\partial B)\cdot (\partial U^*/\partial p_i)} \cdot p_i$$

$$\implies \eta = p_i\left(\frac {\partial^2 U^*/\partial p^2_i}{ \partial U^*/\partial p_i}- \frac{\partial^2 U^*/\partial B^2}{\partial U^*/\partial B}\right) \tag{4}$$

For this expression to be constant over the whole range of $p_i$ we need that

$$\left(\frac {\partial^2 U^*/\partial p^2_i}{ \partial U^*/\partial p_i}- \frac{\partial^2 U^*/\partial B^2}{\partial U^*/\partial B}\right) = \frac {C}{p_i} \tag{5}$$

for some constant $C$, which becomes the constant value of the price elasticity of demand.

That's the general condition that must be satisfied.  

You could check whether the generalized Cobb-Douglas standard Utility function specification

$$U(\mathbf x) = \prod_{i=1}^n x_i^{a_i}$$

satisfies the condition, perhaps under some restrictions.  

THE CASE OF QUASI-LINEAR UTILITY FUNCTION  

The OP ponders the case of a quasi-linear utility function, so let's solve this forward. We have

$$\max_{x,m} [cx^{\theta} +m],;\;\;\; s.t. \;\;\;p_xx + m = B,\;\;\; 0&lt;\theta &lt;1,\;\; c&gt;0$$

where $m$ is residual income for all other goods. The Lagrangean is

$$\Lambda = cx^{\theta} +m + \lambda[B-p_xx - m]$$
and first order conditions are

$$c\theta x^{\theta-1}=\lambda p_x,\\\;\;\; \lambda =1$$

So

$$x^* = \left(\frac {c\theta}{p_x}\right)^{1/(1-\theta)},\;\;\; m^* = B-p_xx^*$$

So the indirect utility function is

$$U^* = c\left(\frac {c\theta}{p_x}\right)^{\theta/(1-\theta)} + B-p_x\left(\frac {c\theta}{p_x}\right)^{1/(1-\theta)}$$

$$= \left[c(c\theta)^{\theta/(1-\theta)} - (c\theta)^{1/(1-\theta)}\right] \cdot \frac {1}{p_x^{\theta/(1-\theta)}} + B$$

One can easily verify that this indirect utility function satisfies the required condition $(5)$ for isoelastic demand, and also see how the preference parameters map to the demand parameters.